diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 9d7c1839..9c2e1d57 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -96,6 +96,8 @@ unsigned char packetIdentifier; #pragma pack(1) +#include "keys.h" + #include "new.h" #include "Types.h" #include "connect.h" @@ -240,10 +242,10 @@ char ckbag[100]; int REPORT_NAME; int WEAPON_READIED_BONUS; - int ENEMY_ENABLED=0; - int CREATURE_ENABLED=0; - int MILITIA_ENABLED=0; - int CIV_ENABLED=0; + int ENEMY_ENABLED; + int CREATURE_ENABLED; + int MILITIA_ENABLED; + int CIV_ENABLED; int ALLOW_EQUIP; @@ -1925,6 +1927,7 @@ void recieveBULLET(RPCParameters *rpcParameters) BULLET * pBullet; iBullet = CreateBullet( netb->net_bullet.ubFirerID, 0, netb->net_bullet.usFlags,netb->usHandItem ); + if (iBullet == -1) { ScreenMsg( FONT_YELLOW, MSG_CHAT, L"Failed to create bullet"); @@ -1934,6 +1937,8 @@ void recieveBULLET(RPCParameters *rpcParameters) bTable[bTeam][net_iBullet].remote_id = net_iBullet; bTable[bTeam][net_iBullet].local_id = iBullet; + + pBullet = GetBulletPtr( iBullet ); //ScreenMsg( FONT_YELLOW, MSG_CHAT, L"Created Bullet Id: %d",iBullet); @@ -2120,14 +2125,17 @@ void send_miss(EV_S_MISS * SMiss) void recievehitSTRUCT (RPCParameters *rpcParameters) { EV_S_STRUCTUREHIT* struct_hit = (EV_S_STRUCTUREHIT*)rpcParameters->input; - + //ScreenMsg( FONT_YELLOW, MSG_CHAT, L"recieved structure hit"); SOLDIERTYPE *pSoldier = MercPtrs[ struct_hit->ubAttackerID ]; INT8 bTeam=pSoldier->bTeam; INT32 iBullet = bTable[bTeam][struct_hit->iBullet].local_id; + + if(struct_hit->fStopped)StopBullet( iBullet );//, ScreenMsg( FONT_YELLOW, MSG_CHAT, L"bullet stopped"); StructureHit( iBullet, struct_hit->usWeaponIndex, struct_hit->bWeaponStatus, struct_hit->ubAttackerID, struct_hit->sXPos, struct_hit->sYPos, struct_hit->sZPos, struct_hit->usStructureID, struct_hit->iImpact, struct_hit->fStopped ); - if(struct_hit->fStopped)RemoveBullet(iBullet); - //ScreenMsg( FONT_YELLOW, MSG_CHAT, L"recieved structure hit"); + if(struct_hit->fStopped)RemoveBullet(iBullet);//, ScreenMsg( FONT_YELLOW, MSG_CHAT, L"bullet removed"); + //else ScreenMsg( FONT_YELLOW, MSG_CHAT, L"bullet left"); + } void recievehitWINDOW (RPCParameters *rpcParameters) { @@ -2420,7 +2428,15 @@ void recieve_door (RPCParameters *rpcParameters) doors* sDoor = (doors*)rpcParameters->input; SOLDIERTYPE *pSoldier = MercPtrs[ sDoor->ubID ]; - HandleDoorChangeFromGridNo( pSoldier, sDoor->sGridNo, sDoor->fNoAnimations ); + BOOLEAN fNoAnimations = FALSE; + + if ( !AllMercsLookForDoor( sDoor->sGridNo, FALSE ) )//check for los + { + fNoAnimations = TRUE; + } + + + HandleDoorChangeFromGridNo( pSoldier, sDoor->sGridNo, fNoAnimations ); } @@ -2578,6 +2594,11 @@ void connect_client ( void ) gTacticalStatus.uiFlags&= (~SHOW_ALL_MERCS ); memset( &readyteamreg , 0 , sizeof (int) * 10); + ENEMY_ENABLED=0; + CREATURE_ENABLED=0; + MILITIA_ENABLED=0; + CIV_ENABLED=0; + //retrieve settings from Ja2_mp.ini char ip[30]; char port[30]; diff --git a/Multiplayer/fresh_header.h b/Multiplayer/fresh_header.h index 8ae94a2c..21b7b2e9 100644 --- a/Multiplayer/fresh_header.h +++ b/Multiplayer/fresh_header.h @@ -60,4 +60,5 @@ void teamwiped (void); BOOLEAN check_status (void); extern UINT8 NumEnemyInSector( ); -extern INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); \ No newline at end of file +extern INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); + diff --git a/Multiplayer/server.cpp b/Multiplayer/server.cpp index 2619289c..03b35f38 100644 --- a/Multiplayer/server.cpp +++ b/Multiplayer/server.cpp @@ -418,7 +418,7 @@ void start_server (void) char hire_same_merc[30]; char bteam1_enabled[30]; - char bteam2_enabled[30]; + //char bteam2_enabled[30]; char bteam3_enabled[30]; char bteam4_enabled[30]; @@ -434,7 +434,7 @@ void start_server (void) GetPrivateProfileString( "Ja2_mp Settings","DAMAGE_MULTIPLIER", "", net_div, MAX_PATH, "..\\Ja2_mp.ini" ); GetPrivateProfileString( "Ja2_mp Settings","ENEMY_ENABLED", "", bteam1_enabled, MAX_PATH, "..\\Ja2_mp.ini" ); - GetPrivateProfileString( "Ja2_mp Settings","CREATURE_ENABLED", "", bteam2_enabled, MAX_PATH, "..\\Ja2_mp.ini" ); + //GetPrivateProfileString( "Ja2_mp Settings","CREATURE_ENABLED", "", bteam2_enabled, MAX_PATH, "..\\Ja2_mp.ini" ); GetPrivateProfileString( "Ja2_mp Settings","MILITIA_ENABLED", "", bteam3_enabled, MAX_PATH, "..\\Ja2_mp.ini" ); GetPrivateProfileString( "Ja2_mp Settings","CIV_ENABLED", "", bteam4_enabled, MAX_PATH, "..\\Ja2_mp.ini" ); @@ -477,7 +477,7 @@ void start_server (void) if(gsPLAYER_BSIDE==2)//only enable ai during coop { ENEMY_ENABLED =atoi(bteam1_enabled); - CREATURE_ENABLED =atoi(bteam2_enabled); + //CREATURE_ENABLED =atoi(bteam2_enabled); MILITIA_ENABLED =atoi(bteam3_enabled); CIV_ENABLED =atoi(bteam4_enabled); diff --git a/Multiplayer/test_space.h b/Multiplayer/test_space.h index 978085b7..9e4d73a8 100644 --- a/Multiplayer/test_space.h +++ b/Multiplayer/test_space.h @@ -11,3 +11,4 @@ INT8 FireBullet( SOLDIERTYPE * pFirer, BULLET * pBullet, BOOLEAN fFake ); extern bool ovh_advance; extern bool ovh_ready; void request_ovh(UINT8 ubID); + diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index 9c4079a5..37f2c0a8 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -938,7 +938,7 @@ void CreatureAttackTown( UINT8 ubSectorID, BOOLEAN fOverrideTest ) case CREATURE_BATTLE_CODE_TACTICALLYADD: if (is_networked) { - if(is_server && CREATURE_ENABLED) + if(is_server && CREATURE_ENABLED==1) PrepareCreaturesForBattle(); } else diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index a5c21e2b..3098df8e 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -771,7 +771,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) if (gfStrategicMilitiaChangesMade) { RemoveMilitiaFromTactical(); - if(is_server && MILITIA_ENABLED) + if(is_server && MILITIA_ENABLED==1) PrepareMilitiaForTactical(FALSE); } } diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 16fb8642..02324e3d 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -1206,7 +1206,7 @@ void AddPossiblePendingEnemiesToBattle() static UINT8 ubPredefinedInsertionCode = 255; // haydent - if ((is_client && !is_server) || !ENEMY_ENABLED) + if ((is_client && !is_server) || ENEMY_ENABLED==0) { return; } diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index bc2479de..284425bb 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -393,7 +393,7 @@ void AddPossiblePendingMilitiaToBattle() static UINT8 ubPredefinedRank = 255; // Haydent - if ((is_client && !is_server) || !MILITIA_ENABLED) + if ((is_client && !is_server) || MILITIA_ENABLED==0) { return; } diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index ec727a09..b0896499 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -1749,7 +1749,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { if (is_networked) { - if(is_server && ENEMY_ENABLED) + if(is_server && ENEMY_ENABLED==1) PrepareEnemyForSectorBattle(); } else @@ -1768,7 +1768,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { if (is_networked) { - if(is_server && CREATURE_ENABLED) + if(is_server && CREATURE_ENABLED==1) PrepareCreaturesForBattle(); } else @@ -2074,7 +2074,7 @@ void PrepareLoadedSector() if (is_networked) { - if( is_server && fAddCivs && CIV_ENABLED)//hayden its around here we apply .ini choices for Ai + if( is_server && fAddCivs && CIV_ENABLED==1)//hayden its around here we apply .ini choices for Ai { AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); } @@ -2084,10 +2084,10 @@ void PrepareLoadedSector() AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); } - if(is_server && MILITIA_ENABLED) + if(is_server && MILITIA_ENABLED==1) AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); - if(is_server && CREATURE_ENABLED) + if(is_server && CREATURE_ENABLED==1) AddSoldierInitListBloodcats(); //Creatures are only added if there are actually some of them. It has to go through some @@ -2121,11 +2121,11 @@ void PrepareLoadedSector() // Haydent if (is_networked) { - if(is_server && CREATURE_ENABLED) + if(is_server && CREATURE_ENABLED==1) PrepareCreaturesForBattle(); // Haydent - if(is_server && MILITIA_ENABLED) + if(is_server && MILITIA_ENABLED==1) PrepareMilitiaForTactical(FALSE); } else @@ -2148,7 +2148,7 @@ void PrepareLoadedSector() if (is_networked) { - if(is_server && CIV_ENABLED) + if(is_server && CIV_ENABLED==1) AddProfilesNotUsingProfileInsertionData(); //hayden: is just for civ's } else @@ -2160,7 +2160,7 @@ void PrepareLoadedSector() { if (is_networked) { - if(is_server && ENEMY_ENABLED) + if(is_server && ENEMY_ENABLED==1) fEnemyPresenceInThisSector = PrepareEnemyForSectorBattle(); } else diff --git a/Tactical/bullets.cpp b/Tactical/bullets.cpp index 2c1e88b7..399dde9c 100644 --- a/Tactical/bullets.cpp +++ b/Tactical/bullets.cpp @@ -29,6 +29,7 @@ #include "lighting.h" #include "Buildings.h" #endif +#include "test_space.h" // Defines diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index feaf650a..4c198e80 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -2174,7 +2174,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) //////////////////////////////////////////////////////////////////////// // IF POSSIBLE, FIRE LONG RANGE WEAPONS AT TARGETS REPORTED BY RADIO //////////////////////////////////////////////////////////////////////// - +if(!is_networked)//hayden +{ // can't do this in realtime, because the player could be shooting a gun or whatever at the same time! if (gfTurnBasedAI && !fCivilian && !bInWater && !bInGas && !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) && (CanNPCAttack(pSoldier) == TRUE)) { @@ -2251,6 +2252,8 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } } + }//hayden + @@ -3937,6 +3940,8 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) // this looks for throwables, and sets BestThrow.ubPossible if it can be done //if ( !gfHiddenInterrupt ) // { + if(!is_networked) //disable for mp ai + { CheckIfTossPossible(pSoldier,&BestThrow); if (BestThrow.ubPossible) @@ -3973,7 +3978,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier) } - + }