*** Merged Code from Multiplayer Branch Revision 2960 ***

- Virtual File System (VFS) by birdflu. This is needed for Multiplayer and is also used for Single Player. Very neat system :-)
- Multiplayer Version 1.1 + some additional features and bugfixes
* INFO: If you compile a new EXE and want to test, be sure to also use the latest SVN GameDir files in your JA2 install directory *




git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2961 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2009-06-04 21:01:45 +00:00
parent 17f44f63e8
commit 47db604b50
301 changed files with 76701 additions and 1843 deletions
+2 -1
View File
@@ -4,7 +4,8 @@
#include "types.h"
#define MAX_CACHE_SIZE 20
#define MIN_CACHE_SIZE 2
//#define MIN_CACHE_SIZE 2
#define MIN_CACHE_SIZE 4
typedef struct
+5 -5
View File
@@ -1073,7 +1073,7 @@ BOOLEAN AddFacesToAutoBandageBox( void )
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
{
// find a free slot
if( iDoctorList[ iCounter ] != -1 )
@@ -1096,7 +1096,7 @@ BOOLEAN AddFacesToAutoBandageBox( void )
}
}
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
{
// find a free slot
if( iPatientList[ iCounter ] != -1 )
@@ -1134,7 +1134,7 @@ BOOLEAN RemoveFacesForAutoBandage( void )
INT32 iCounter = 0, iNumberOfDoctors = 0;
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
{
// find a free slot
if( iDoctorList[ iCounter ] != -1 )
@@ -1146,7 +1146,7 @@ BOOLEAN RemoveFacesForAutoBandage( void )
}
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
{
// find a free slot
if( iPatientList[ iCounter ] != -1 )
@@ -1182,7 +1182,7 @@ BOOLEAN RenderSoldierSmallFaceForAutoBandagePanel( INT32 iIndex, INT16 sCurrentX
BltVideoObject( FRAME_BUFFER , hHandle , 0, sCurrentXPosition+2, sCurrentYPosition+2, VO_BLT_SRCTRANSPARENCY, NULL );
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
{
// find a free slot
if( iDoctorList[ iCounter ] != -1 )
+1 -1
View File
@@ -249,7 +249,7 @@ void ShutDownQuoteBox( BOOLEAN fForce )
}
else
{
ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[39] );
ScreenMsg( FONT_LTGREEN, MSG_MPSYSTEM, MPClientMessage[39] );
ActionDone( gCivQuoteData.pCiv );
}
}
+1 -1
View File
@@ -1360,7 +1360,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY
pSoldier = MercPtrs[ i ];
//make sure the person is active, alive, in the sector, and is not a profiled person
if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife && pSoldier->ubProfile == NO_PROFILE )
if( pSoldier && pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife && pSoldier->ubProfile == NO_PROFILE )
{ //soldier is valid, so find the matching soldier init list entry for modification.
curr = gSoldierInitHead;
while( curr && curr->pSoldier != pSoldier )
+1 -1
View File
@@ -2966,7 +2966,7 @@ BOOLEAN AddTopMessage( UINT8 ubType, STR16 pzString )
gTacticalStatus.fInTopMessage = TRUE;
// Copy string
wcscpy( gTacticalStatus.zTopMessageString, pzString );
wcsncpy( gTacticalStatus.zTopMessageString, pzString, 19 );
CreateTopMessage( gTopMessage.uiSurface, ubType, pzString );
+7
View File
@@ -273,12 +273,19 @@ const int startingZ = 0;
// ENUMERATION OF SOLDIER POSIITONS IN GLOBAL SOLDIER LIST
// WDS - make number of mercenaries, etc. be configurable
#define CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS 32
extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS;
#define CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES 6
extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES;
#define CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS+CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES
extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS;
#define CODE_MAXIMUM_NUMBER_OF_ENEMIES 64
extern UINT8 giMAXIMUM_NUMBER_OF_ENEMIES;
#define CODE_MAXIMUM_NUMBER_OF_CREATURES 40
extern UINT8 giMAXIMUM_NUMBER_OF_CREATURES;
#define CODE_MAXIMUM_NUMBER_OF_REBELS 64
extern UINT8 giMAXIMUM_NUMBER_OF_REBELS;
#define CODE_MAXIMUM_NUMBER_OF_CIVS 40
extern UINT8 giMAXIMUM_NUMBER_OF_CIVS;
// The following should be the largest from the above set of constants.
// Note: Is there any way to compute this via the preprocessor?
+26 -13
View File
@@ -117,6 +117,16 @@
#include "test_space.h"
#include "connect.h"
// OJW - 20090419
UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS = CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS;
UINT8 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES = CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES;
UINT8 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
UINT8 giMAXIMUM_NUMBER_OF_ENEMIES = CODE_MAXIMUM_NUMBER_OF_ENEMIES;
UINT8 giMAXIMUM_NUMBER_OF_CREATURES = CODE_MAXIMUM_NUMBER_OF_CREATURES;
UINT8 giMAXIMUM_NUMBER_OF_REBELS = CODE_MAXIMUM_NUMBER_OF_REBELS;
UINT8 giMAXIMUM_NUMBER_OF_CIVS = CODE_MAXIMUM_NUMBER_OF_CIVS;
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -362,16 +372,16 @@ UINT8 bDefaultTeamRanges[ MAXTEAMS_SP ][ 2 ] =
COLORVAL bDefaultTeamColors[ MAXTEAMS ] =
{
FROMRGB( 255, 255, 0 ),
FROMRGB( 255, 255, 0 ), // own team: yellow
FROMRGB( 255, 0, 0 ),
FROMRGB( 255, 0, 255 ),
FROMRGB( 0, 255, 0 ),
FROMRGB( 255, 255, 255 ),
FROMRGB( 0, 0, 255 ),
FROMRGB( 255, 156, 49 ), //hayden //team 1 (radar colours)
FROMRGB( 49, 255, 207 ), //2
FROMRGB( 193, 85, 255 ), //3
FROMRGB( 0, 255, 115 ) //4
FROMRGB( 255, 120, 0 ), //hayden //team 1 (radar colours) // orange
FROMRGB( 62, 140, 240 ), //2 // light blue
FROMRGB( 180, 50, 255 ), //3 // violett
FROMRGB( 0, 180, 20 ) //4 // green
};
@@ -7075,16 +7085,19 @@ BOOLEAN CheckForLosingEndOfBattle( )
gfKillingGuysForLosingBattle = FALSE;
if ( fDoCapture )
// WANNE - MP: Only do special scenes (capture, ...) in a single player game
if (!is_networked)
{
EndCaptureSequence( );
SetCustomizableTimerCallbackAndDelay( 3000, CaptureTimerCallback, FALSE );
if ( fDoCapture )
{
EndCaptureSequence( );
SetCustomizableTimerCallbackAndDelay( 3000, CaptureTimerCallback, FALSE );
}
else
{
SetCustomizableTimerCallbackAndDelay( 10000, DeathTimerCallback, FALSE );
}
}
else
{
SetCustomizableTimerCallbackAndDelay( 10000, DeathTimerCallback, FALSE );
}
}
return( TRUE );
}
+2 -2
View File
@@ -441,7 +441,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
if(is_networked) {
if(is_networked && (pCreateStruct->fOnRoof==1))
{
ScreenMsg( FONT_YELLOW, MSG_CHAT, L"skipping roof merc");
ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"skipping roof merc");
return NULL;
}
@@ -462,7 +462,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
if(is_networked && (pCreateStruct->bBodyType==23 || pCreateStruct->bBodyType==24))
{
ScreenMsg( FONT_YELLOW, MSG_CHAT, L"skipping tank");
ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"skipping tank");
return NULL;
}
}
+1 -1
View File
@@ -753,7 +753,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
}
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: return false"));
if(is_server) ScreenMsg( FONT_YELLOW, MSG_CHAT, L"report this MP error (AddPlacementToWorld-FAIL!)");
if(is_server) ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"report this MP error (AddPlacementToWorld-FAIL!)");
return FALSE;
}
+3 -2
View File
@@ -485,8 +485,9 @@ BOOLEAN RemoveCharacterFromSquads( SOLDIERTYPE *pCharacter )
AddDeadCharacterToSquadDeadGuys( pCharacter, iCounterA );
}
//if we are not loading a saved game
if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) && guiCurrentScreen == GAME_SCREEN )
//if we are not loading a saved game
// OJW - 20090427 - fix bug leaving gamescree/tactical for MAIN_MENU
if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) && guiCurrentScreen == GAME_SCREEN && guiPendingScreen != MAINMENU_SCREEN )
{
UpdateCurrentlySelectedMerc( pCharacter, ( INT8 )iCounterA );
}
+6 -2
View File
@@ -48,6 +48,8 @@
#include "Map Screen Interface Map Inventory.h"
#endif
#include "VFS/vfs.h"
BOOLEAN gfWasInMeanwhile = FALSE;
@@ -1546,6 +1548,7 @@ BOOLEAN RetrieveTempFileFromSavedGame( HWFILE hFile, UINT32 uiType, INT16 sMapX,
//Deletes the Temp map Directory
BOOLEAN InitTacticalSave( BOOLEAN fCreateTempDir )
{
#ifndef USE_VFS
UINT32 uiRetVal;
//If the Map Temp directory exists, removes the temp files
@@ -1569,13 +1572,14 @@ BOOLEAN InitTacticalSave( BOOLEAN fCreateTempDir )
AssertMsg( 0, "Error creating the Temp Directory.");
}
}
#else
EraseDirectory( MAPS_DIR );
#endif
if( fCreateTempDir )
{
//Create the initial temp file for the Npc Quote Info
InitTempNpcQuoteInfoForNPCFromTempFile();
}
return( TRUE );
}
+18 -13
View File
@@ -932,16 +932,18 @@ void StartInterrupt( void )
}
// otherwise it's the AI interrupting another AI team
gTacticalStatus.ubCurrentTeam = pSoldier->bTeam;
//#ifdef JA2BETAVERSION
if (pSoldier != NULL)
gTacticalStatus.ubCurrentTeam = pSoldier->bTeam;
if (is_networked)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Interrupt ( could be hidden )" );
//#endif
//send_interrupt( pSoldier );//hayden
StartNPCAI( pSoldier );
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Interrupt ( could be hidden )" );
#endif
}
if (pSoldier != NULL)
StartNPCAI( pSoldier );
}
}
@@ -1776,11 +1778,14 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f
#ifdef DEBUG_INTERRUPTS
DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("Calculating int pts for %d vs %d, number is %d", pSoldier->ubID, ubOpponentID, iPoints ) );
#endif
if(is_networked)
{
SOLDIERTYPE *pOpp = &Menptr[ubOpponentID];
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_CHAT, L"Interrupt: '%s' vs '%s' = %d points.",pSoldier->name,pOpp->name, iPoints );
}
if(is_networked)
{
SOLDIERTYPE *pOpp = &Menptr[ubOpponentID];
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_MPSYSTEM, L"Interrupt: '%s' vs '%s' = %d points.",pSoldier->name,pOpp->name, iPoints );
#endif
}
DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"CalcInterruptDuelPts done");
return( (INT8)iPoints );
}
+35 -31
View File
@@ -2366,27 +2366,31 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
}
else if ( fCtrl ) // The_Bob - real time sneaking, 01-06-09
{ // ctrl-x: enter turn based while sneaking - check if RT sneak is on, iw we're not already in combat and if we actually see any enemies
if (gGameExternalOptions.fAllowRealTimeSneak)
{
if (!is_networked)
{
BOOLEAN fSneakingInRealTime = true;
// ctrl-x: enter turn based while sneaking - check if RT sneak is on, iw we're not already in combat and if we actually see any enemies
if (gGameExternalOptions.fAllowRealTimeSneak)
{
BOOLEAN fSneakingInRealTime = true;
if( gTacticalStatus.uiFlags & INCOMBAT )
{ // Don't allow this in combat
if (!gGameExternalOptions.fQuietRealTimeSneak)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_IN_COMBAT_ALREADY]);
fSneakingInRealTime = false;
}
if( gTacticalStatus.uiFlags & INCOMBAT )
{ // Don't allow this in combat
if (!gGameExternalOptions.fQuietRealTimeSneak)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_IN_COMBAT_ALREADY]);
fSneakingInRealTime = false;
}
if( WeSeeNoOne() )
{ // Don't allow this if no enemies are seen - we have the forced turn mode for that
if (!gGameExternalOptions.fQuietRealTimeSneak)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_NO_ENEMIES]);
fSneakingInRealTime = false;
if( WeSeeNoOne() )
{ // Don't allow this if no enemies are seen - we have the forced turn mode for that
if (!gGameExternalOptions.fQuietRealTimeSneak)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_NO_ENEMIES]);
fSneakingInRealTime = false;
}
if (fSneakingInRealTime)
EnterCombatMode(OUR_TEAM);
}
if (fSneakingInRealTime)
EnterCombatMode(OUR_TEAM);
}
}
break;
@@ -2394,25 +2398,25 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
case 'X': // shift-ctrl-x: toggle real time sneaking
if ( fCtrl )
{
if (gGameExternalOptions.fAllowRealTimeSneak)
if (!is_networked)
{
gGameExternalOptions.fAllowRealTimeSneak = false;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_OFF]);
if( !WeSeeNoOne() ) // if we're sneaking up on someone, enter turn-based
EnterCombatMode(OUR_TEAM);
if (gGameExternalOptions.fAllowRealTimeSneak)
{
gGameExternalOptions.fAllowRealTimeSneak = false;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_OFF]);
if( !WeSeeNoOne() ) // if we're sneaking up on someone, enter turn-based
EnterCombatMode(OUR_TEAM);
}
else
{
gGameExternalOptions.fAllowRealTimeSneak = true;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_ON]);
}
}
else
{
gGameExternalOptions.fAllowRealTimeSneak = true;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_SNEAKING_ON]);
}
}
break;
case '/':
// Center to guy....
+1 -1
View File
@@ -452,7 +452,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId )
pVehicleSoldier = GetSoldierStructureForVehicle( iId );
//CHRISL: Get number of vehicles currently in player team
for(int x = 0; x < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; x++)
for(int x = 0; x < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; x++)
{
if(MercPtrs[x]->bTeam == OUR_TEAM && (MercPtrs[x]->flags.uiStatusFlags & SOLDIER_VEHICLE) && MercPtrs[x]->bActive == TRUE)
vCount ++;
+1 -2
View File
@@ -402,8 +402,7 @@ BOOLEAN ReadInLBEPocketStats(STR fileName, BOOLEAN localizedVersion)
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
+2 -2
View File
@@ -232,8 +232,8 @@ BOOLEAN ReadInlbeStats(STR fileName)
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
LoadBearingEquipment.clear();
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
+5 -2
View File
@@ -545,8 +545,11 @@ BOOLEAN ReadInMercStartingGearStats(STR fileName)
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
for(int i=0; i<NUM_PROFILES; ++i)
{
gMercProfileGear[i].clearInventory();
}
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
-3
View File
@@ -92,7 +92,6 @@ inline bool OKToCheckOpinion(int profileNumber) {
return (profileNumber < DontUseMeDirectly::MaxIDToCheckForMorale);
}
typedef enum
{
NO_SKILLTRAIT = 0,
@@ -368,7 +367,6 @@ public:
INT8 bTown;
INT8 bTownAttachment;
UINT16 usOptionalGearCost;
// See above note near the definition of MaxIDToCheckForMorale
INT8 bMercOpinion[DontUseMeDirectly::MaxIDToCheckForMorale];
@@ -606,7 +604,6 @@ public:
INT8 bTown;
INT8 bTownAttachment;
UINT16 usOptionalGearCost;
// See above note near the definition of MaxIDToCheckForMorale
INT8 bMercOpinion[DontUseMeDirectly::MaxIDToCheckForMorale];