Merged Multi Player Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2144 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-05-12 08:20:47 +00:00
parent c448713412
commit 3e22dce318
132 changed files with 14527 additions and 4859 deletions
+7
View File
@@ -17,8 +17,15 @@
#define BULLET_FLAG_FLAME 0x0080
#define BULLET_FLAG_TRACER 0x0100
//afp-start calculate line points between two point
#define BULLET_TRACER_MAX_LENGTH 60
void PointsPath(int sx1, int sy1, int ex2, int ey2) ;
//afp-end
typedef struct
{
//afp-start this structure keeps tracers points
LEVELNODE* pNodes[BULLET_TRACER_MAX_LENGTH];
//afp-end
INT32 iBullet;
UINT8 ubFirerID;
UINT8 ubTargetID;
+4 -2
View File
@@ -33,7 +33,7 @@
#include "Strategic Mines.h"
#include "Random.h"
#endif
#include "connect.h"
#define DIALOGUE_DEFAULT_WIDTH 200
#define EXTREAMLY_LOW_TOWN_LOYALTY 20
@@ -242,7 +242,9 @@ void ShutDownQuoteBox( BOOLEAN fForce )
// do we need to do anything at the end of the civ quote?
if ( gCivQuoteData.pCiv && gCivQuoteData.pCiv->aiData.bAction == AI_ACTION_OFFER_SURRENDER )
{
DoMessageBox( MSG_BOX_BASIC_STYLE, Message[ STR_SURRENDER ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SurrenderMessageBoxCallBack, NULL );
// Haydent
if(!is_client)DoMessageBox( MSG_BOX_BASIC_STYLE, Message[ STR_SURRENDER ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SurrenderMessageBoxCallBack, NULL );
else ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[39] );
}
}
}
+7
View File
@@ -57,6 +57,8 @@
#include "qarray.h"
#endif
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -1288,6 +1290,11 @@ BOOLEAN TacticalCharacterDialogueWithSpecialEventEx( SOLDIERTYPE *pSoldier, UINT
BOOLEAN TacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteNum )
{
// Haydent
if(is_client)
{
return(FALSE); //somewhere amongst all this it causes a puase of merc movement while making the quote which throws out the movement sync between clients... : hayden.
}
if ( pSoldier->ubProfile == NO_PROFILE )
{
return( FALSE );
+4
View File
@@ -34,7 +34,10 @@
#include "Isometric Utils.h"
#include "ai.h"
#include "Soldier macros.h"
#include "Event Pump.h"
#endif
#include "fresh_header.h"
#include "connect.h"
BOOLEAN gfSetPerceivedDoorState = FALSE;
@@ -942,6 +945,7 @@ BOOLEAN HandleOpenableStruct( SOLDIERTYPE *pSoldier, INT16 sGridNo, STRUCTURE *p
if ( fDoor )
{
HandleDoorChangeFromGridNo( pSoldier, sGridNo, FALSE );
if(is_client)send_door( pSoldier, sGridNo, FALSE );
}
else
{
+8
View File
@@ -1,3 +1,4 @@
#include "connect.h"
#ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#else
@@ -555,15 +556,21 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
if ( pSoldier->sSpreadLocations[ 0 ] != 0 )
{
SendBeginFireWeaponEvent( pSoldier, pSoldier->sSpreadLocations[ 0 ] );
if(is_server || (is_client && pSoldier->ubID <20) ) send_fire( pSoldier, pSoldier->sSpreadLocations[ 0 ] );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Handle Items.cpp: SendBeginFireWeaponEvent" );
}
else
{
SendBeginFireWeaponEvent( pSoldier, sTargetGridNo );
if(is_server || (is_client && pSoldier->ubID <20) ) send_fire( pSoldier, sTargetGridNo );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Handle Items.cpp: SendBeginFireWeaponEvent" );
}
}
else
{
SendBeginFireWeaponEvent( pSoldier, sTargetGridNo );
if(is_server || (is_client && pSoldier->ubID <20) ) send_fire( pSoldier, sTargetGridNo );
}
// ATE: Here to make cursor go back to move after LAW shot...
@@ -1367,6 +1374,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
{
SendBeginFireWeaponEvent( pSoldier, sTargetGridNo );
if(is_server || (is_client && pSoldier->ubID <20) ) send_fire( pSoldier, sTargetGridNo );
}
+27 -8
View File
@@ -1,3 +1,4 @@
#include "connect.h"
#ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#include "BuildDefines.h"
@@ -88,6 +89,7 @@
#include "Soldier Control.h"
#endif
#include "teamturns.h"
//extern BOOLEAN gfDisplayFullCountRingBurst;
extern UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady );
@@ -1196,7 +1198,22 @@ UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent )
}
// End our turn!
EndTurn( gbPlayerNum + 1 );
if (is_server || !is_client)
{
EndTurn( gbPlayerNum + 1 );
}
if(!is_server && is_client)
{
if (INTERRUPT_QUEUED)
{
EndTurn( gbPlayerNum + 1 );//is ending interrupt instead
}
else
{
send_EndTurn( netbTeam+1 );//for sending next netbteam rather than next local team
}
}
}
return( GAME_SCREEN );
@@ -5842,18 +5859,20 @@ void UnSetUIBusy( UINT8 ubID )
{
if ( gfUserTurnRegionActive && (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) && ( gTacticalStatus.ubCurrentTeam == gbPlayerNum ) )
{
if ( !gTacticalStatus.fUnLockUIAfterHiddenInterrupt )
{
if ( gusSelectedSoldier == ubID )
if ( !gTacticalStatus.fUnLockUIAfterHiddenInterrupt )
{
guiPendingOverrideEvent = LA_ENDUIOUTURNLOCK;
HandleTacticalUI( );
if ( gusSelectedSoldier == ubID && (gTacticalStatus.ubCurrentTeam == OUR_TEAM || !is_networked))// now that mp
{
guiPendingOverrideEvent = LA_ENDUIOUTURNLOCK;
HandleTacticalUI( );
// Set grace period...
gTacticalStatus.uiTactialTurnLimitClock = GetJA2Clock( );
// Set grace period...
gTacticalStatus.uiTactialTurnLimitClock = GetJA2Clock( );
}
}
// player getting control back so reset all muzzle flashes
}
// player getting control back so reset all muzzle flashes
}
}
-1
View File
@@ -6572,7 +6572,6 @@ void DeleteItemStackPopup( )
//CHRISL: if neither item or sector stack popups are open, just return.
if(!gfInItemStackPopup && !gfInSectorStackPopup)
return;
//Remove
DeleteVideoObjectFromIndex( guiItemPopupBoxes );
-1
View File
@@ -7019,4 +7019,3 @@ void GoToMapScreenFromTactical( void )
+11 -3
View File
@@ -58,6 +58,7 @@
#include "message.h"
#endif
#include "connect.h"
//const UINT32 INTERFACE_START_X = 0;
//const UINT32 INTERFACE_START_Y = ( SCREEN_HEIGHT - INTERFACE_HEIGHT );
//const UINT32 INV_INTERFACE_START_Y = ( SCREEN_HEIGHT - INV_INTERFACE_HEIGHT );
@@ -2928,10 +2929,11 @@ void EndUIMessage( )
#define PLAYER_TEAM_TIMER_INTTERUPT_GRACE ( 15000 / PLAYER_TEAM_TIMER_SEC_PER_TICKS )
#define PLAYER_TEAM_TIMER_GRACE_PERIOD 1000
#define PLAYER_TEAM_TIMER_SEC_PER_TICKS 100
//#define PLAYER_TEAM_TIMER_SEC_PER_TICKS 100
int PLAYER_TEAM_TIMER_SEC_PER_TICKS = 100;//hayden
#define PLAYER_TEAM_TIMER_TICKS_PER_OK_MERC ( 15000 / PLAYER_TEAM_TIMER_SEC_PER_TICKS )
#define PLAYER_TEAM_TIMER_TICKS_PER_NOTOK_MERC ( 5000 / PLAYER_TEAM_TIMER_SEC_PER_TICKS )
#define PLAYER_TEAM_TIMER_TICKS_FROM_END_TO_START_BEEP ( 5000 / PLAYER_TEAM_TIMER_SEC_PER_TICKS )
#define PLAYER_TEAM_TIMER_TICKS_FROM_END_TO_START_BEEP ( (5000 / PLAYER_TEAM_TIMER_SEC_PER_TICKS)*1.15 )
#define PLAYER_TEAM_TIMER_TIME_BETWEEN_BEEPS ( 500 )
#define PLAYER_TEAM_TIMER_TICKS_PER_ENEMY ( 2000 / PLAYER_TEAM_TIMER_SEC_PER_TICKS )
@@ -3289,7 +3291,8 @@ void HandleTopMessages( )
if ( TIMECOUNTERDONE( giTimerTeamTurnUpdate, PLAYER_TEAM_TIMER_SEC_PER_TICKS ) )
{
RESETTIMECOUNTER( giTimerTeamTurnUpdate, PLAYER_TEAM_TIMER_SEC_PER_TICKS );
if(!is_networked)//hayden - stop clients from updating enemy progress bar... //could have another param in here when get coop going
{
// Update counter....
if ( gTacticalStatus.usTactialTurnLimitCounter < gTacticalStatus.usTactialTurnLimitMax )
{
@@ -3301,6 +3304,8 @@ void HandleTopMessages( )
{
gTacticalStatus.usTactialTurnLimitCounter = ( ( gubProgCurEnemy ) * PLAYER_TEAM_TIMER_TICKS_PER_ENEMY );
}
}
CreateTopMessage( gTopMessage.uiSurface, gTacticalStatus.ubTopMessageType, gTacticalStatus.zTopMessageString );
}
@@ -3544,6 +3549,9 @@ void InitPlayerUIBar( BOOLEAN fInterrupt )
return;
}
if (is_networked)
gTacticalStatus.usTactialTurnLimitMax = 0;//hayden , cheap hack, always calc time...
// OK, calculate time....
if ( !fInterrupt || gTacticalStatus.usTactialTurnLimitMax == 0 )
{
+1
View File
@@ -223,6 +223,7 @@ bool IsSlotASmallPocket(int slot);
extern std::list<LBENODE> LBEArray;
//do not alter or saves will break, create new defines if the size changes
#define OLD_MAX_ATTACHMENTS_101 4
#define OLD_MAX_OBJECTS_PER_SLOT_101 8
+82 -7
View File
@@ -1,3 +1,4 @@
#include "connect.h"
#ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#else
@@ -41,7 +42,8 @@
#include "Quests.h"
#include "items.h"
#endif
#include "fresh_header.h"
#include "test_space.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -2325,7 +2327,23 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
}
// handle hit! Handle damage before deleting the bullet though
WeaponHit( SWeaponHit.usSoldierID, SWeaponHit.usWeaponIndex, SWeaponHit.sDamage, SWeaponHit.sBreathLoss, SWeaponHit.usDirection, SWeaponHit.sXPos, SWeaponHit.sYPos, SWeaponHit.sZPos, SWeaponHit.sRange, SWeaponHit.ubAttackerID, SWeaponHit.fHit, SWeaponHit.ubSpecial, SWeaponHit.ubLocation );
//hayden
if(SWeaponHit.ubAttackerID < 20 ||(is_server && SWeaponHit.ubAttackerID < 120)|| !is_client ) // 124 last possible ai
{
if(is_client)
SWeaponHit.sDamage=(INT16)(SWeaponHit.sDamage * DAMAGE_MULTIPLIER); // adjust damage from external variable //hayden
WeaponHit( SWeaponHit.usSoldierID, SWeaponHit.usWeaponIndex, SWeaponHit.sDamage, SWeaponHit.sBreathLoss, SWeaponHit.usDirection, SWeaponHit.sXPos, SWeaponHit.sYPos, SWeaponHit.sZPos, SWeaponHit.sRange, SWeaponHit.ubAttackerID, SWeaponHit.fHit, SWeaponHit.ubSpecial, SWeaponHit.ubLocation );
if(is_server || (is_client && SWeaponHit.ubAttackerID <20) )
{
SWeaponHit.fStopped=fStopped;
SWeaponHit.iBullet=pBullet->iBullet;
send_hit( &SWeaponHit );
}
}
if (fStopped)
{
@@ -2384,17 +2402,48 @@ void BulletHitStructure( BULLET * pBullet, UINT16 usStructureID, INT32 iImpact,
SStructureHit.usStructureID = usStructureID;
SStructureHit.iImpact = iImpact;
SStructureHit.iBullet = pBullet->iBullet;
if (is_networked)
SStructureHit.fStopped = fStopped;
//hayden
if(is_client)
send_hitstruct(&SStructureHit);
StructureHit( SStructureHit.iBullet, SStructureHit.usWeaponIndex, SStructureHit.bWeaponStatus, SStructureHit.ubAttackerID, SStructureHit.sXPos, SStructureHit.sYPos, SStructureHit.sZPos, SStructureHit.usStructureID, SStructureHit.iImpact, fStopped );
}
void BulletHitWindow( BULLET *pBullet, INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth )
{
if (is_networked)
{
EV_S_WINDOWHIT SWindowHit;
SWindowHit.sGridNo = sGridNo;
SWindowHit.usStructureID = usStructureID;
SWindowHit.fBlowWindowSouth = fBlowWindowSouth;
SWindowHit.fLargeForce = FALSE;
SWindowHit.iBullet = pBullet->iBullet;
SWindowHit.ubAttackerID=pBullet->pFirer->ubID;
//hayden
if(is_client)
send_hitwindow(&SWindowHit);
}
WindowHit( sGridNo, usStructureID, fBlowWindowSouth, FALSE );
}
void BulletMissed( BULLET *pBullet, SOLDIERTYPE * pFirer )
{
if (is_networked)
{
EV_S_MISS SMiss;
SMiss.iBullet=pBullet->iBullet;
SMiss.ubAttackerID=pFirer->ubID;
//hayden
if(is_client)
send_miss(&SMiss);
}
ShotMiss( pFirer->ubID, pBullet->iBullet );
}
@@ -3482,7 +3531,15 @@ INT8 FireBullet( SOLDIERTYPE * pFirer, BULLET * pBullet, BOOLEAN fFake )
}
else
{
pBullet->usClockTicksPerUpdate = (Weapon[ pFirer->usAttackingWeapon ].ubBulletSpeed + GetBulletSpeedBonus(&pFirer->inv[pFirer->ubAttackingHand]) ) / 10;
//afp-start //always a fast bullet
if ( pBullet->usFlags & ( BULLET_FLAG_CREATURE_SPIT | BULLET_FLAG_KNIFE | BULLET_FLAG_MISSILE | BULLET_FLAG_SMALL_MISSILE | BULLET_FLAG_TANK_CANNON | BULLET_FLAG_FLAME /*| BULLET_FLAG_TRACER*/ ) )
pBullet->usClockTicksPerUpdate = (Weapon[ pFirer->usAttackingWeapon ].ubBulletSpeed + GetBulletSpeedBonus(&pFirer->inv[pFirer->ubAttackingHand]) ) / 10;
else
if (gGameExternalOptions.gbBulletTracer)
pBullet->usClockTicksPerUpdate = (Weapon[ pFirer->usAttackingWeapon ].ubBulletSpeed + GetBulletSpeedBonus(&pFirer->inv[pFirer->ubAttackingHand]) ) / 10;
else
pBullet->usClockTicksPerUpdate = 1;
//afp-end
}
//DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("FireBullet: handle flags"));
@@ -3773,6 +3830,8 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
// // this is an error!!
// ubLoop = ubLoop;
// }
//hayden
if(is_client)send_bullet( pBullet, usHandItem );
FireBullet( pFirer, pBullet, FALSE );
}
}
@@ -3896,7 +3955,10 @@ void MoveBullet( INT32 iBullet )
// NB remove bullet only flags a bullet for deletion; we still have access to the
// information in the structure
RemoveBullet( pBullet->iBullet );
BulletMissed( pBullet, pBullet->pFirer );
if(ENABLE_COLLISION)
BulletMissed( pBullet, pBullet->pFirer );//only if local origin
return;
}
@@ -3940,7 +4002,10 @@ void MoveBullet( INT32 iBullet )
{
fIntended = FALSE;
}
//check for structures at target, and calc chance to hit
//hayden, disable any structure t avoid collision
if(ENABLE_COLLISION)
{
while( pStructure )
{
if (pStructure->fFlags & ALWAYS_CONSIDER_HIT)
@@ -4140,6 +4205,7 @@ void MoveBullet( INT32 iBullet )
pStructure = pStructure->pNext;
}
}
// check to see if any soldiers are nearby; those soldiers
// have their near-miss value incremented
if (pMapElement->ubAdjacentSoldierCnt > 0)
@@ -4226,6 +4292,9 @@ void MoveBullet( INT32 iBullet )
// check for collision with the ground
iCurrAboveLevelZ = FIXEDPT_TO_INT32( pBullet->qCurrZ - qLandHeight );
//hayden not hit ground
if(ENABLE_COLLISION)
{
if (iCurrAboveLevelZ < 0)
{
// ground is in the way!
@@ -4233,6 +4302,7 @@ void MoveBullet( INT32 iBullet )
BulletHitStructure( pBullet, INVALID_STRUCTURE_ID, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE );
return;
}
}
// check for the existence of structures
if (iNumLocalStructures == 0 && !pRoofStructure)
{ // no structures in this tile, AND THAT INCLUDES ROOFS! :-)
@@ -4280,6 +4350,9 @@ void MoveBullet( INT32 iBullet )
// special coding (compared with other versions above) to deal with
// bullets hitting the ground
//hayden, stop hit ground
if(ENABLE_COLLISION)
{
if (pBullet->qCurrZ + pBullet->qIncrZ * iStepsToTravel < qLandHeight)
{
iStepsToTravel = __min( iStepsToTravel, abs( (pBullet->qCurrZ - qLandHeight) / pBullet->qIncrZ ) );
@@ -4291,6 +4364,7 @@ void MoveBullet( INT32 iBullet )
BulletHitStructure( pBullet, INVALID_STRUCTURE_ID, 0, pBullet->pFirer, pBullet->qCurrX, pBullet->qCurrY, pBullet->qCurrZ, TRUE );
return;
}
}
if (( pBullet->usFlags & ( BULLET_FLAG_MISSILE | BULLET_FLAG_SMALL_MISSILE | BULLET_FLAG_TANK_CANNON | BULLET_FLAG_FLAME | BULLET_FLAG_CREATURE_SPIT /*| BULLET_FLAG_TRACER*/ ) ) || fTracer == TRUE)
{
@@ -4544,7 +4618,8 @@ void MoveBullet( INT32 iBullet )
{
pBullet->qCurrX += pBullet->qIncrX;
pBullet->qCurrY += pBullet->qIncrY;
if (pRoofStructure)
//no hit on lan//pRoofStructure//hayden
if (is_networked && pRoofStructure)
{
qLastZ = pBullet->qCurrZ;
pBullet->qCurrZ += pBullet->qIncrZ;
@@ -4609,7 +4684,7 @@ void MoveBullet( INT32 iBullet )
{
// bullet outside of world!
RemoveBullet( pBullet->iBullet );
BulletMissed( pBullet, pBullet->pFirer );
if(ENABLE_COLLISION)BulletMissed( pBullet, pBullet->pFirer );//hayden: only play event if local
return;
}
+49 -26
View File
@@ -59,7 +59,7 @@
#include "Quests.h"
#include "GameSettings.h"
#endif
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -102,7 +102,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
if( ( pMerc->bMercStatus != 0 ) && (pMerc->bMercStatus != MERC_ANNOYED_BUT_CAN_STILL_CONTACT ) && ( pMerc->bMercStatus != MERC_HIRED_BUT_NOT_ARRIVED_YET ) )
return( MERC_HIRE_FAILED );
if( NumberOfMercsOnPlayerTeam() >= 18 )
if( NumberOfMercsOnPlayerTeam() >= 18 || (is_client && NumberOfMercsOnPlayerTeam() >= MAX_MERCS)) //hayden, 7 member team limit setable in ini
return( MERC_HIRE_OVER_18_MERCS_HIRED );
// ATE: if we are to use landing zone, update to latest value
@@ -123,6 +123,9 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
MercCreateStruct.bSectorZ = pHireMerc->bSectorZ;
MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM;
MercCreateStruct.fCopyProfileItemsOver= pHireMerc->fCopyProfileItemsOver;
if(!ALLOW_EQUIP && is_networked)
MercCreateStruct.fCopyProfileItemsOver=0;//hayden : server overide
if ( !TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) )
{
@@ -192,36 +195,50 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
//Set the type of merc
if( DidGameJustStart() )
if (!is_networked)
{
// Set time of initial merc arrival in minutes
pHireMerc->uiTimeTillMercArrives = ( gGameExternalOptions.iGameStartingTime + gGameExternalOptions.iFirstArrivalDelay ) / NUM_SEC_IN_MIN;
if( DidGameJustStart() )
{
pHireMerc->uiTimeTillMercArrives = ( gGameExternalOptions.iGameStartingTime + gGameExternalOptions.iFirstArrivalDelay ) / NUM_SEC_IN_MIN;
// Set insertion for first time in chopper
pHireMerc->ubInsertionCode = INSERTION_CODE_CHOPPER;
// Set insertion for first time in chopper
pHireMerc->ubInsertionCode = INSERTION_CODE_CHOPPER;
//set when the merc's contract is finished
pSoldier->iEndofContractTime = GetMidnightOfFutureDayInMinutes( pSoldier->iTotalContractLength ) + ( GetHourWhenContractDone( pSoldier ) * 60 );
//set when the merc's contract is finished
pSoldier->iEndofContractTime = GetMidnightOfFutureDayInMinutes( pSoldier->iTotalContractLength ) + ( GetHourWhenContractDone( pSoldier ) * 60 );
}
else
{
//set when the merc's contract is finished ( + 1 cause it takes a day for the merc to arrive )
pSoldier->iEndofContractTime = GetMidnightOfFutureDayInMinutes( 1 + pSoldier->iTotalContractLength ) + ( GetHourWhenContractDone( pSoldier ) * 60 );
}
}
// WANNE - MP: We need this, so the merc contract is correct!
else
{
//set when the merc's contract is finished ( + 1 cause it takes a day for the merc to arrive )
pSoldier->iEndofContractTime = GetMidnightOfFutureDayInMinutes( 1 + pSoldier->iTotalContractLength ) + ( GetHourWhenContractDone( pSoldier ) * 60 );
pSoldier->iEndofContractTime = GetMidnightOfFutureDayInMinutes( pSoldier->iTotalContractLength ) + ( GetHourWhenContractDone( pSoldier ) * 60 );
}
//Set the time and ID of the last hired merc will arrive
LaptopSaveInfo.sLastHiredMerc.iIdOfMerc = pHireMerc->ubProfileID;
LaptopSaveInfo.sLastHiredMerc.uiArrivalTime = pHireMerc->uiTimeTillMercArrives;
//if we are trying to hire a merc that should arrive later, put the merc in the queue
if( pHireMerc->uiTimeTillMercArrives != 0 )
if (!is_client)
{
AddStrategicEvent( EVENT_DELAYED_HIRING_OF_MERC, pHireMerc->uiTimeTillMercArrives, pSoldier->ubID );
//specify that the merc is hired but hasnt arrived yet
pMerc->bMercStatus = MERC_HIRED_BUT_NOT_ARRIVED_YET;
//if we are trying to hire a merc that should arrive later, put the merc in the queue
if( pHireMerc->uiTimeTillMercArrives != 0 )
{
AddStrategicEvent( EVENT_DELAYED_HIRING_OF_MERC, pHireMerc->uiTimeTillMercArrives, pSoldier->ubID );
//specify that the merc is hired but hasnt arrived yet
pMerc->bMercStatus = MERC_HIRED_BUT_NOT_ARRIVED_YET;
}
}
else
{
if(is_client)send_hire( iNewIndex, ubCurrentSoldier, pHireMerc->iTotalContractLength, MercCreateStruct.fCopyProfileItemsOver );
//send off hire info to network, also avail possibility for net-game exclusive hired pSoldier changes...
}
@@ -265,7 +282,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
//Set starting conditions for the merc
pSoldier->iStartContractTime = GetWorldDay( );
AddHistoryToPlayersLog(HISTORY_HIRED_MERC_FROM_MERC, ubCurrentSoldier, GetWorldTotalMin(), -1, -1 );
if(!is_client)AddHistoryToPlayersLog(HISTORY_HIRED_MERC_FROM_MERC, ubCurrentSoldier, GetWorldTotalMin(), -1, -1 );
}
//If the merc is from IMP, (ie a player character)
else if( ( ubCurrentSoldier >= 51 ) && ( ubCurrentSoldier < 57 ) )
@@ -294,13 +311,19 @@ void MercArrivesCallback( UINT8 ubSoldierID )
SOLDIERTYPE *pSoldier;
UINT32 uiTimeOfPost;
if( !DidGameJustStart() && gsMercArriveSectorX == 9 && gsMercArriveSectorY == 1 )
{ //Mercs arriving in A9. This sector has been deemed as the always safe sector.
//Seeing we don't support entry into a hostile sector (except for the beginning),
//we will nuke any enemies in this sector first.
if( gWorldSectorX != 9 || gWorldSectorY != 1 || gbWorldSectorZ )
{
EliminateAllEnemies( (UINT8)gsMercArriveSectorX, (UINT8)gsMercArriveSectorY );
if (!is_networked)
{
// hayden - maybe you want to duke it out in omerta ;)
if( !DidGameJustStart() && gsMercArriveSectorX == 9 && gsMercArriveSectorY == 1 )
{
//Mercs arriving in A9. This sector has been deemed as the always safe sector.
//Seeing we don't support entry into a hostile sector (except for the beginning),
//we will nuke any enemies in this sector first.
if( gWorldSectorX != 9 || gWorldSectorY != 1 || gbWorldSectorZ )
{
EliminateAllEnemies( (UINT8)gsMercArriveSectorX, (UINT8)gsMercArriveSectorY );
}
}
}
+8
View File
@@ -20,8 +20,11 @@
#include "Campaign.h"
#include "mapscreen.h"
#include "Soldier macros.h"
#include "Event Pump.h"
#endif
#include "connect.h"
#include "fresh_header.h"
#define MORALE_MOD_MAX 50 // morale *mod* range is -50 to 50, if you change this, check the decay formulas!
#define DRUG_EFFECT_MORALE_MOD 150
@@ -322,6 +325,11 @@ void UpdateSoldierMorale( SOLDIERTYPE * pSoldier, UINT8 ubType, INT8 bMoraleMod
{
return;
}
if(DISABLE_MORALE && is_networked)
{
return;
}//hayden
pProfile = &(gMercProfiles[ pSoldier->ubProfile ]);
+7 -2
View File
@@ -23,7 +23,7 @@
#define MIN_AMB_LEVEL_FOR_MERC_LIGHTS 9
#define MAXTEAMS 6
#define MAXTEAMS 11 //hayden
#define MAXMERCS MAX_NUM_SOLDIERS
//TACTICAL OVERHEAD STUFF
@@ -274,9 +274,14 @@ enum WorldDirections
#define CREATURE_TEAM 2
#define MILITIA_TEAM 3
#define CIV_TEAM 4
#define LAST_TEAM CIV_TEAM
#define LAST_TEAM LAN_TEAM_FOUR
#define PLAYER_PLAN 5
#define LAN_TEAM_ONE 6
#define LAN_TEAM_TWO 7
#define LAN_TEAM_THREE 8
#define LAN_TEAM_FOUR 9
//hayden
//-----------------------------------------------
//
+131 -17
View File
@@ -112,8 +112,10 @@
#include "PreBattle Interface.h"
#include "Militia Control.h"
#include "Lua Interpreter.h"
#include "bullets.h"
#endif
#include "test_space.h"
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -123,6 +125,7 @@ extern void HandleBestSightingPositionInRealtime();
extern UINT8 gubAICounter;
#include "fresh_header.h"
#define RT_DELAY_BETWEEN_AI_HANDLING 50
#define RT_AI_TIMESLICE 10
@@ -324,24 +327,44 @@ CHAR8 gzDirectionStr[][ 30 ] =
};
// TEMP VALUES FOR TEAM DEAFULT POSITIONS
UINT8 bDefaultTeamRanges[ MAXTEAMS ][ 2 ] =
UINT8 bDefaultTeamRanges[ MAXTEAMS ][ 2 ] =
{
0, 19, //20 US
20, 51, //32 ENEMY
52, 83, //32 CREATURE
84, 115, //32 REBELS ( OUR GUYS )
116, MAX_NUM_SOLDIERS - 1, //32 CIVILIANS
MAX_NUM_SOLDIERS, TOTAL_SOLDIERS - 1 // PLANNING SOLDIERS
0, 19, //20 US
20, 51, //32 ENEMY
52, 52, //kulled off to make room ;) //32 CREATURE
53, 84, //32 REBELS ( OUR GUYS )
85, 116, //32 CIVILIANS
117, 119, // PLANNING SOLDIERS (reduced)
120, 126, //1 //new sides //hayden // 7 each
127, 133, //2
134, 140, //3
141, MAX_NUM_SOLDIERS - 1, //4
MAX_NUM_SOLDIERS, TOTAL_SOLDIERS - 1 // PLANNING SOLDIERS
};
COLORVAL bDefaultTeamColors[ MAXTEAMS ] =
//{
// 0, 19, //20 US
// 20, 51, //32 ENEMY
// 52, 83, //32 CREATURE
// 84, 115, //32 REBELS ( OUR GUYS )
// 116, MAX_NUM_SOLDIERS - 1, //32 CIVILIANS
//MAX_NUM_SOLDIERS, TOTAL_SOLDIERS - 1 // PLANNING SOLDIERS
//};
COLORVAL bDefaultTeamColors[ MAXTEAMS ] =
{
FROMRGB( 255, 255, 0 ),
FROMRGB( 255, 0, 0 ),
FROMRGB( 255, 0, 255 ),
FROMRGB( 0, 255, 0 ),
FROMRGB( 255, 255, 255 ),
FROMRGB( 0, 0, 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
};
@@ -684,7 +707,12 @@ BOOLEAN InitOverhead( )
gTacticalStatus.uiCountdownToRestart = GetJA2Clock();
gTacticalStatus.fGoingToEnterDemo = FALSE;
gTacticalStatus.fNOTDOLASTDEMO = FALSE;
gTacticalStatus.fDidGameJustStart = TRUE;
if (is_networked)
gTacticalStatus.fDidGameJustStart = FALSE; //hayden
else
gTacticalStatus.fDidGameJustStart = TRUE;
gTacticalStatus.ubLastRequesterTargetID = NO_PROFILE;
for ( cnt = 0; cnt < NUM_PANIC_TRIGGERS; cnt++ )
@@ -1124,6 +1152,7 @@ BOOLEAN ExecuteOverhead( )
// Handle animation update counters
// ATE: Added additional check here for special value of anispeed that pauses all updates
{
#ifndef BOUNDS_CHECKER
if ( TIMECOUNTERDONE( pSoldier->timeCounters.UpdateCounter, pSoldier->sAniDelay ) && pSoldier->sAniDelay != 10000 )
#endif
@@ -1169,6 +1198,16 @@ BOOLEAN ExecuteOverhead( )
{
continue;
}
//hayden - holt at scheduled grid
if (is_networked)
{
if(pSoldier->sGridNo==pSoldier->sScheduledStop)
{
pSoldier->HaultSoldierFromSighting( 1 );
pSoldier->sScheduledStop=NULL;
}
}
if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_SPECIALMOVE ) )
{
@@ -1594,6 +1633,19 @@ BOOLEAN ExecuteOverhead( )
}
}
}
//if(is_client)//hayden
//{
// if(pSoldier->flags.fIsSoldierDelayed==TRUE)
// {
// continue;//in position but waiting on other clients
// }
// else
// {
// //ovh_advance=false;
// pSoldier->flags.fIsSoldierDelayed=TRUE;
// request_ovh(pSoldier->ubID);
// }
//}
}
if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_PAUSEANIMOVE ) )
@@ -1601,8 +1653,21 @@ BOOLEAN ExecuteOverhead( )
fKeepMoving = FALSE;
}
BOOLEAN executeCondition = FALSE;
if (is_networked)
{
if ( !pSoldier->flags.fPausedMove && fKeepMoving && !pSoldier->flags.fNoAPToFinishMove )
executeCondition = TRUE;
}
else
{
if ( !pSoldier->flags.fPausedMove && fKeepMoving )
executeCondition = TRUE;
}
// DO WALKING
if ( !pSoldier->flags.fPausedMove && fKeepMoving )
if ( executeCondition )
{
// Determine deltas
// dDeltaX = pSoldier->pathing.sDestXPos - pSoldier->dXPos;
@@ -1642,8 +1707,12 @@ BOOLEAN ExecuteOverhead( )
if (pSoldier->flags.fSoldierUpdatedFromNetwork)
UpdateSoldierFromNetwork(pSoldier);
#endif
//haydens network soldier update ->>
if(is_client)UpdateSoldierToNetwork ( pSoldier );
//
}
}
if ( !gfPauseAllAI &&
( ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) || (fHandleAI && guiAISlotToHandle == cnt) || (pSoldier->aiData.fAIFlags & AI_HANDLE_EVERY_FRAME) || gTacticalStatus.fAutoBandageMode ) )
{
@@ -5564,7 +5633,16 @@ void EnterCombatMode( UINT8 ubStartingTeam )
}
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... calling startplayerteamturn");
StartPlayerTeamTurn( FALSE, TRUE );
if (!is_client || is_server) //hayden
{
StartPlayerTeamTurn( FALSE, TRUE );
if(is_client)send_EndTurn( ubStartingTeam ); //hayden
}
else
{
//ScreenMsg( FONT_YELLOW, MSG_CHAT, L"client skipped EnterCombatMode");
if(is_client)startCombat(ubStartingTeam);//clients other than server meet and send request for combat for server
}
}
else
{
@@ -5856,6 +5934,10 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen )
{
return( FALSE );
}
//if (is_server || is_client)
//{
// return(FALSE); // cheap band-aid to prevent return from turn based action in multiplayer, atleast until further dev... : hayden.
//}
// if we're boxing NEVER end combat mode
if ( gTacticalStatus.bBoxingState == BOXING )
@@ -5927,8 +6009,17 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen )
// If we have reach a point where a cons. number of turns gone by....
if ( gTacticalStatus.bConsNumTurnsNotSeen > 1 )
{
gTacticalStatus.bConsNumTurnsNotSeen = 0;
if(is_networked && !getReal)//hayden
{
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, MPClientMessage[32] );
sendRT();
return(FALSE);
}
gTacticalStatus.bConsNumTurnsNotSeen = 0;
// Exit mode!
ExitCombatMode();
@@ -5993,7 +6084,14 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen )
void DeathNoMessageTimerCallback( void )
{
CheckAndHandleUnloadingOfCurrentWorld();
//CheckAndHandleUnloadingOfCurrentWorld();
if(!is_client)CheckAndHandleUnloadingOfCurrentWorld();
else
{
ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[40] );
gTacticalStatus.uiFlags |= SHOW_ALL_MERCS;//hayden
ScreenMsg( FONT_YELLOW, MSG_CHAT, MPClientMessage[41] );
}
}
void RemoveStaticEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY )
@@ -6103,6 +6201,9 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
// Play death music
SetMusicMode( MUSIC_TACTICAL_DEATH );
SetCustomizableTimerCallbackAndDelay( 10000, DeathNoMessageTimerCallback, FALSE );
if (is_networked)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, MPClientMessage[42] );
if ( CheckFact( FACT_FIRST_BATTLE_BEING_FOUGHT, 0 ) )
{
@@ -7404,8 +7505,9 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! &&&&&&& Problem with attacker busy count decrementing past 0.... preventing wrap-around." ) );
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Attack busy problem. Save, exit and send debug.txt + save file to Sir-Tech." );
if(!is_networked)ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Attack busy problem. Save, exit and send debug.txt + save file to Sir-Tech." );
DebugAttackBusy( "Attack Busy Problem\n");
//cheap hack to suppress message in MP - hayden.
#endif
}
}
@@ -7454,6 +7556,12 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
// would work quite well. If only I could close all the holes that the UI opens so that one routine could handle everything.
if (!pSoldier)
{
if (is_networked)
{
if(gusSelectedSoldier==156)
return( NULL );
}
pSoldier = MercPtrs[ gusSelectedSoldier ];
}
@@ -8046,7 +8154,13 @@ void DoneFadeOutDueToDeath( void )
void EndBattleWithUnconsciousGuysCallback( UINT8 bExitValue )
{
// Enter mapscreen.....
CheckAndHandleUnloadingOfCurrentWorld();
if(!is_client)CheckAndHandleUnloadingOfCurrentWorld();
else
{
ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[40] );
gTacticalStatus.uiFlags |= SHOW_ALL_MERCS;//hayden
ScreenMsg( FONT_YELLOW, MSG_CHAT, MPClientMessage[41] );
}
}
+3 -3
View File
@@ -42,7 +42,7 @@
#include "gamesettings.h"
#include "Buildings.h"
#endif
#include "connect.h"
#include "PathAIDebug.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -581,7 +581,7 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
else if (!GridNoOnVisibleWorldTile( StartNode ) )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", StartNode, DestNode );
if(!is_networked)ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", StartNode, DestNode );
#endif
return( 0 );
}
@@ -2411,7 +2411,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
else if (!GridNoOnVisibleWorldTile( (INT16) iOrigination ) )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", iOrigination, sDestination );
if(!is_networked)ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"ERROR! Trying to calculate path from non-visible gridno %d to %d", iOrigination, sDestination );
#endif
return( 0 );
}
+24 -4
View File
@@ -34,7 +34,7 @@
#include "Map Information.h"
#include "Interface Items.h"
#endif
#include "connect.h"
//rain
//#define BREATH_GAIN_REDUCTION_PER_RAIN_INTENSITY 25
//end rain
@@ -537,7 +537,6 @@ BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLE
//CHRISL: if we don't have soldier information, assume we have enough points.
if(pSoldier == NULL)
return( TRUE );
// If this guy is on a special move... don't care about APS, OR BPSs!
if ( pSoldier->ubWaitActionToDo )
{
@@ -563,6 +562,14 @@ BOOLEAN EnoughPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost, BOOLE
}
#endif
if (is_networked)
{
if(pSoldier->ubID > 119 || (!is_server && pSoldier->ubID > 20))
{
return(TRUE);
}//hayden , if soldier replication, allow.
}
// Get New points
sNewAP = pSoldier->bActionPoints - sAPCost;
@@ -623,8 +630,21 @@ void DeductPoints( SOLDIERTYPE *pSoldier, INT16 sAPCost, INT32 iBPCost,BOOLEAN f
// NB: iBPCost > 0 - breath loss, iBPCost < 0 - breath gain
if (iBPCost)
{
// Adjust breath changes due to spending or regaining of energy
iBPCost = AdjustBreathPts(pSoldier, iBPCost);
if (is_networked)
{
// Adjust breath changes due to spending or regaining of energy
if(!pSoldier->bActive)
{
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"test_func2" );
}
else
iBPCost = AdjustBreathPts(pSoldier, iBPCost);
}
else
{
iBPCost = AdjustBreathPts(pSoldier, iBPCost);
}
// Snap: award some health and strength for exertion
// Do 4 StatChange rolls for health (2 for strength) per 10 breath points spent?
+8 -3
View File
@@ -23,7 +23,7 @@
#include "Exit Grids.h"
#endif
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -1162,8 +1162,13 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
}
else
{
sGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->sInsertionGridNo, 7, &ubCalculatedDirection );
if(is_client && (pSoldier->ubStrategicInsertionCode == INSERTION_CODE_GRIDNO))
{
sGridNo = pSoldier->sInsertionGridNo;
ubCalculatedDirection = pSoldier->ubDirection;
}
else sGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->sInsertionGridNo, 7, &ubCalculatedDirection );
//hayden
// ATE: Error condition - if nowhere use insertion gridno!
if ( sGridNo == NOWHERE )
{
+14 -3
View File
@@ -66,8 +66,8 @@
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
#include "connect.h"
#include "fresh_header.h"
#define NO_JUMP 0
#define MAX_ANIFRAMES_PER_FLASH 2
//#define TIME_FOR_RANDOM_ANIM_CHECK 10
@@ -367,8 +367,13 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
SFireWeapon.sTargetGridNo = pSoldier->sTargetGridNo;
SFireWeapon.bTargetLevel = pSoldier->bTargetLevel;
SFireWeapon.bTargetCubeLevel= pSoldier->bTargetCubeLevel;
if((is_server && pSoldier->ubID<120) || (!is_server && is_client && pSoldier->ubID<20) || (!is_server && !is_client) )
{//only carry on if own werc
AddGameEvent( S_FIREWEAPON, 0, &SFireWeapon );
//hayden
if(is_server || (is_client && pSoldier->ubID <20) ) send_fireweapon( &SFireWeapon );
}
//DIGICRAB: Burst UnCap
//Loop around in the animation if we still have burst rounds to fire
if (pSoldier->bDoBurst && (pSoldier->bDoBurst <= ((pSoldier->bDoAutofire)?(pSoldier->bDoAutofire):(GetShotsPerBurst(&pSoldier->inv[HANDPOS]))) || (( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST && pSoldier->bDoBurst <= Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS])].ubShotsPerBurst)) ))
@@ -3209,6 +3214,12 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse )
if ( pSoldier->stats.bLife == 0 && !( pSoldier->flags.uiStatusFlags & SOLDIER_DEAD ) )
{
// Haydent
if (is_networked)
//send death info
send_death(pSoldier);//quickfix
// Cancel services here...
pSoldier->ReceivingSoldierCancelServices( );
pSoldier->GivingSoldierCancelServices( );
+79 -10
View File
@@ -97,7 +97,7 @@
#include "Strategic Pathing.h"
#endif
#include "fresh_header.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -122,6 +122,7 @@ extern INT16 DirIncrementer[8];
#define MIN_SUBSEQUENT_SNDS_DELAY 2000
#include "connect.h"
// Enumerate extended directions
enum
@@ -1649,6 +1650,34 @@ void SOLDIERTYPE::AdjustNoAPToFinishMove( BOOLEAN fSet )
// this->DeleteSoldierLight( );
}
//send it on
if (is_networked && this->ubID < 120)
{
//if(this->ubID>=120)
// return;//hayden
EV_S_STOP_MERC SStopMerc;
SStopMerc.sGridNo = this->sGridNo;
SStopMerc.ubDirection = this->ubDirection;
SStopMerc.usSoldierID = this->ubID;
SStopMerc.fset=fSet;
SStopMerc.sXPos=this->sX;
SStopMerc.sYPos=this->sY;
//AddGameEvent( S_STOP_MERC, 0, &SStopMerc ); //hayden.
if(is_client)
send_stop(&SStopMerc);
}
this->flags.fNoAPToFinishMove = fSet;
if ( !fSet )
@@ -2484,9 +2513,20 @@ BOOLEAN SOLDIERTYPE::ChangeSoldierState( UINT16 usNewState, UINT16 usStartingAni
SChangeState.uiUniqueId = this->uiUniqueSoldierIdValue;
//AddGameEvent( S_CHANGESTATE, 0, &SChangeState );
if(is_server && this->ubID < 120)
{
this->EVENT_InitNewSoldierAnim( SChangeState.usNewState, SChangeState.usStartingAniCode, SChangeState.fForce );
send_changestate(&SChangeState);
}
else if(is_client && !is_server && this->ubID < 20)
{
this->EVENT_InitNewSoldierAnim( SChangeState.usNewState, SChangeState.usStartingAniCode, SChangeState.fForce );
send_changestate(&SChangeState);
}
else if (!is_client)
{
this->EVENT_InitNewSoldierAnim( SChangeState.usNewState, SChangeState.usStartingAniCode, SChangeState.fForce );
}
return( TRUE );
}
@@ -4649,8 +4689,16 @@ BOOLEAN SOLDIERTYPE::InternalSoldierReadyWeapon( UINT8 sFacingDir, BOOLEAN fEndR
if ( usAnimState != INVALID_ANIMATION )
{
if(is_networked)
{
ChangeSoldierState( usAnimState, 0 , FALSE );//this passes it to an area where it gets sent over the network.
}
else
{
this->EVENT_InitNewSoldierAnim( usAnimState, 0 , FALSE );
}
fReturnVal = TRUE;
}
if ( !fEndReady )
@@ -5906,7 +5954,11 @@ BOOLEAN SOLDIERTYPE::EVENT_InternalGetNewSoldierPath( INT16 sDestGridNo, UINT16
this->usDontUpdateNewGridNoOnMoveAnimChange = TRUE;
this->EVENT_InitNewSoldierAnim( usMoveAnimState, 0, FALSE );
if(is_server || (is_client && this->ubID <20) ) send_path( this, sDestGridNo, usMoveAnimState , 0 , FALSE );
return( TRUE );
}
if(is_server || (is_client && this->ubID <20) ) send_path( this, sDestGridNo, this->usAnimState , 255 , FALSE );
return( TRUE );
}
@@ -5964,11 +6016,13 @@ BOOLEAN SOLDIERTYPE::EVENT_InternalGetNewSoldierPath( INT16 sDestGridNo, UINT16
{
this->EVENT_InitNewSoldierAnim( usAnimState, 0, FALSE );
this->usPendingAnimation = usMoveAnimState;
if(is_server || (is_client && this->ubID <20) ) send_path( this, sDestGridNo, usAnimState , 0 , FALSE );
}
else
{
// Call local copy for change soldier state!
this->EVENT_InitNewSoldierAnim( usMoveAnimState, 0, fForceRestartAnim );
if(is_server || (is_client && this->ubID <20) ) send_path( this, sDestGridNo, usMovementAnim , 0 , fForceRestartAnim );
}
@@ -7539,6 +7593,8 @@ void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier )
// ATE: If we are an enemy and are not visible......
// Set speed to 0
if(!is_client)
{
if ( ( gTacticalStatus.uiFlags & TURNBASED && ( gTacticalStatus.uiFlags & INCOMBAT ) ) || gTacticalStatus.fAutoBandageMode )
{
if ( ( ( pSoldier->bVisible == -1 && pSoldier->bVisible == pSoldier->bLastRenderVisibleValue ) || gTacticalStatus.fAutoBandageMode ) && pSoldier->usAnimState != MONSTER_UP )
@@ -7555,6 +7611,7 @@ void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier )
return;
}
}
}
// Default stats soldier to same as normal soldier.....
pStatsSoldier = pSoldier;
@@ -7882,7 +7939,11 @@ void SOLDIERTYPE::BeginSoldierClimbUpRoof( void )
}
INT8 bNewDirection;
UINT8 ubWhoIsThere;
if(is_client)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, MPClientMessage[43] );
return;//hayden disable climbing roof
}
if ( FindHeigherLevel( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel == 0 ) )
{
if ( EnoughPoints( this, GetAPsToClimbRoof( this, FALSE ), 0, TRUE ) )
@@ -9749,6 +9810,7 @@ void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesire
SSetDesiredDirection.uiUniqueId = pSoldier->uiUniqueSoldierIdValue;
AddGameEvent( S_SETDESIREDDIRECTION, 0, &SSetDesiredDirection );
if(is_server || (is_client && pSoldier->ubID <20) ) send_dir( pSoldier, usDesiredDirection );
}
@@ -9783,8 +9845,10 @@ void SendChangeSoldierStanceEvent( SOLDIERTYPE *pSoldier, UINT8 ubNewStance )
AddGameEvent( S_CHANGESTANCE, 0, &SChangeStance );
#endif
if((pSoldier->ubID > 19) && is_networked)
return;
pSoldier->ChangeSoldierStance( ubNewStance );
if(is_server || (is_client && pSoldier->ubID <20) ) send_stance( pSoldier, ubNewStance );
}
@@ -10905,12 +10969,17 @@ void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("HaultSoldierFromSighting") );
// SEND HUALT EVENT!
//EV_S_STOP_MERC SStopMerc;
EV_S_STOP_MERC SStopMerc;
//SStopMerc.sGridNo = this->sGridNo;
//SStopMerc.bDirection = this->ubDirection;
//SStopMerc.usSoldierID = this->ubID;
//AddGameEvent( S_STOP_MERC, 0, &SStopMerc );
SStopMerc.sGridNo = this->sGridNo;
SStopMerc.ubDirection = this->ubDirection;
SStopMerc.usSoldierID = this->ubID;
SStopMerc.fset=TRUE;
SStopMerc.sXPos=this->sX;
SStopMerc.sYPos=this->sY;
//AddGameEvent( S_STOP_MERC, 0, &SStopMerc ); //hayden.
if(this->ubID>=120) return;//hayden
if(is_client)send_stop(&SStopMerc);
// If we are a 'specialmove... ignore...
if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_SPECIALMOVE ) )
+1
View File
@@ -907,6 +907,7 @@ public:
UINT32 uiSoldierUpdateNumber;
BYTE ubSoldierUpdateType;
UINT16 sScheduledStop; //hayden, used for scheduling a grid to stop
//END
INT32 iStartOfInsuranceContract;
+37
View File
@@ -47,6 +47,7 @@
#include "math.h"
#endif
#include "connect.h"
// THESE 3 DIFFICULTY FACTORS MUST ALWAYS ADD UP TO 100% EXACTLY!!!
#define DIFF_FACTOR_PLAYER_PROGRESS 50
@@ -428,6 +429,42 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
*pubID = NOBODY;
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("TacticalCreateSoldier"));
INT8 tbTeam;
BOOLEAN tfPP;
tbTeam=pCreateStruct->bTeam;
tfPP=pCreateStruct->fPlayerPlan; //used as temp indicator of struct sent from the server //hayden.
if(is_client && !is_server && (tbTeam >0 && tbTeam < 5) && tfPP==0)
{
return NULL; // pure client to not spawn AI unless from server, Hayden.
//gTacticalStatus.Team[ tbTeam ].bTeamActive=0;
}
//if(is_server && tbTeam>0 && tbTeam<5)
if(is_server && tbTeam>0 && tbTeam<5)
{
//if(tbTeam==1 && !ENEMY_ENABLED)
//{
// return NULL;
//}
//if(tbTeam==2 && !CREATURE_ENABLED)
//{
// return NULL;
//}
//if(tbTeam==3 && !MILITIA_ENABLED)
//{
// return NULL;
//}
//if(tbTeam==4 && !CIV_ENABLED)
//{
// return NULL;
//}
send_AI(pCreateStruct,pubID);
}
if(is_client && !is_server && tfPP==1)
{
pCreateStruct->fPlayerPlan = 0;
}
//hayden
//Kris:
//Huge no no! See the header file for description of static detailed placements.
//If this expression ever evaluates to true, then it will expose serious problems.
+1
View File
@@ -272,6 +272,7 @@ public:
BOOLEAN fUseGivenVehicle;
INT8 bUseGivenVehicleID;
BOOLEAN fHasKeys;
INT8 PADDINGSLOTS[ 14 ];
//
// New and OO stuff goes after here. Above this point any changes will goof up reading from files.
+15 -3
View File
@@ -56,6 +56,7 @@
#include "strategic.h"
#endif
#include "connect.h"
#ifdef JA2EDITOR
extern BOOLEAN gfProfileDataLoaded;
#endif
@@ -447,7 +448,7 @@ BOOLEAN LoadMercProfiles(void)
DecideActiveTerrorists();
// initialize mercs' status
StartSomeMercsOnAssignment( );
if(!is_networked)StartSomeMercsOnAssignment( );
// initial recruitable mercs' reputation in each town
InitializeProfilesForTownReputation( );
@@ -988,11 +989,22 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam )
pNewSoldier->bLastRenderVisibleValue = pSoldier->bLastRenderVisibleValue;
pNewSoldier->bVisible = pSoldier->bVisible;
// 0verhaul: Need to pass certain flags over. COWERING is one of them. Others to be determined.
pNewSoldier->flags.uiStatusFlags |= pSoldier->flags.uiStatusFlags & (SOLDIER_COWERING | SOLDIER_MUTE | SOLDIER_GASSED);
// copy uiStatusFlags, etc. - hayden :)
if (is_networked)
{
pNewSoldier->flags.uiStatusFlags = pSoldier->flags.uiStatusFlags;
pNewSoldier->ubProfile = pSoldier->ubProfile;
}
else
{
pNewSoldier->flags.uiStatusFlags |= pSoldier->flags.uiStatusFlags & (SOLDIER_COWERING | SOLDIER_MUTE | SOLDIER_GASSED);
}
if ( ubTeam == gbPlayerNum )
{
pNewSoldier->bVisible = 1;
pNewSoldier->bVisible= 1;
}
//CHRISL: Rather then resorting the profile, which recreates all the items, what if we simply try and sort the
+1 -1
View File
@@ -15,7 +15,7 @@
#define AM_A_ROBOT( p ) ( ( p->ubProfile == NO_PROFILE ) ? FALSE : ( gMercProfiles[ p->ubProfile ].ubBodyType == ROBOTNOWEAPON ) )
#define OK_ENEMY_MERC( p ) ( !p->aiData.bNeutral && (p->bSide != gbPlayerNum ) && p->stats.bLife >= OKLIFE )
#define OK_ENEMY_MERC( p ) ( !p->aiData.bNeutral && (p->bSide != gbPlayerNum ) && p->stats.bLife >= OKLIFE && (p->bTeam < 5 ))
// Checks if our guy can be controllable .... checks bInSector, team, on duty, etc...
#define OK_CONTROLLABLE_MERC( p ) ( p->stats.bLife >= OKLIFE && p->bActive && p->bInSector && p->bTeam == gbPlayerNum && p->bAssignment < ON_DUTY )
+2 -2
View File
@@ -333,7 +333,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;..\Standard Gaming Platform&quot;;..\TileEngine;..\;..\Utils;..\tacticalai;..\Editor;..\strategic;..\lua;..\Laptop;.\"
AdditionalIncludeDirectories="..\Multiplayer;&quot;..\Standard Gaming Platform&quot;;..\TileEngine;..\;..\Utils;..\tacticalai;..\Editor;..\strategic;..\lua;..\Laptop;.\"
PreprocessorDefinitions="CALLBACKTIMER;PRECOMPILEDHEADERS;_DEBUG;WIN32;_WINDOWS;JA2;_VTUNE_PROFILING;XML_STATIC;CINTERFACE"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
@@ -390,7 +390,7 @@
FavorSizeOrSpeed="1"
OptimizeForProcessor="3"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories="&quot;..\Standard Gaming Platform&quot;;..\TileEngine;..\;..\Utils;..\tacticalai;..\Editor;..\strategic;..\Laptop;.\"
AdditionalIncludeDirectories="..\Multiplayer;..\lua;&quot;..\Standard Gaming Platform&quot;;..\TileEngine;..\;..\Utils;..\tacticalai;..\Editor;..\strategic;..\Laptop;.\"
PreprocessorDefinitions="CALLBACKTIMER;PRECOMPILEDHEADERS;NDEBUG;WIN32;_WINDOWS;JA2;XML_STATIC;CINTERFACE"
StringPooling="TRUE"
RuntimeLibrary="0"
+3 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="Tactical_2005Express"
ProjectGUID="{D4BDA6AD-9B61-4953-892D-DA3F8CC7E096}"
RootNamespace="Tactical_2005Express"
@@ -41,6 +41,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
AdditionalIncludeDirectories="..\Multiplayer"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -104,6 +105,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
AdditionalIncludeDirectories="..\Multiplayer"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
+231 -20
View File
@@ -49,12 +49,12 @@
#endif
#include "Reinforcement.h"
#include "fresh_header.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
#include "connect.h"
//#include "test_space.h"
extern INT8 STRAIGHT;
//extern UINT8 gubSpeedUpAnimationFactor;
@@ -248,6 +248,9 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode )
}
// Signal UI done enemy's turn
guiPendingOverrideEvent = LU_ENDUILOCK;
if (is_networked)
guiPendingOverrideEvent = LA_ENDUIOUTURNLOCK;
// ATE: Reset killed on attack variable.. this is because sometimes timing is such
/// that a baddie can die and still maintain it's attacker ID
@@ -266,7 +269,14 @@ void FreezeInterfaceForEnemyTurn( void )
ErasePath( TRUE );
// Setup locked UI
guiPendingOverrideEvent = LU_BEGINUILOCK;
if(is_client)
{
guiPendingOverrideEvent = LA_BEGINUIOURTURNLOCK;
}
else
{
guiPendingOverrideEvent = LU_BEGINUILOCK;
}
// Remove any UI messages!
if ( giUIMessageOverlay != -1 )
@@ -296,7 +306,12 @@ void EndTurn( UINT8 ubNextTeam )
if (INTERRUPT_QUEUED)
{
EndInterrupt( FALSE );
if(is_networked)
{
end_interrupt( FALSE );//this tells other client to go on from where he was
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"ending interrupt" );
}
EndInterrupt( FALSE );
}
else
{
@@ -320,7 +335,7 @@ void EndTurn( UINT8 ubNextTeam )
gTacticalStatus.ubCurrentTeam = ubNextTeam;
BeginTeamTurn( gTacticalStatus.ubCurrentTeam );
if(is_server || !is_client) BeginTeamTurn( gTacticalStatus.ubCurrentTeam );
BetweenTurnsVisibilityAdjustments();
}
@@ -435,6 +450,11 @@ void BeginTeamTurn( UINT8 ubTeam )
ubTeam = gbPlayerNum;
gTacticalStatus.ubCurrentTeam = gbPlayerNum;
EndTurnEvents();
if(is_server)
{
numreadyteams =0;//beginning round
memset( &readyteamreg , 0 , sizeof (int) * 10);
}
}
else
{
@@ -486,18 +506,45 @@ void BeginTeamTurn( UINT8 ubTeam )
if ( ( gTacticalStatus.uiFlags & INCOMBAT ) )
{
StartPlayerTeamTurn( TRUE, FALSE );
/* if(is_server && !net_turn) send_EndTurn(ubTeam);
if(net_turn == true) net_turn = false;*/
if(is_server)
{
numreadyteams =0;//beginning round
memset( &readyteamreg , 0 , sizeof (int) * 10);
send_EndTurn(netbTeam);
}
}
break;
}
else
if (ubTeam > 4 || (is_client && !is_server )) //hayden
{
InitEnemyUIBar( 0, 0 );
fInterfacePanelDirty = DIRTYLEVEL2;
AddTopMessage( COMPUTER_TURN_MESSAGE, TeamTurnString[ ubTeam ] );
/*if(is_server && !net_turn) send_EndTurn(ubTeam);
if(net_turn == true) net_turn = false;*/
if(is_server) send_EndTurn(ubTeam);
//return;
break;
}
else
{
#ifdef NETWORKED
// Only the host should do this
if(!gfAmIHost)
break;
#endif
if( is_client && !is_server ) //hayden //disable independant client AI
break;
// Set First enemy merc to AI control
// Set First enemy merc to AI control
if ( BuildAIListForTeam( ubTeam ) )
{
@@ -515,6 +562,10 @@ void BeginTeamTurn( UINT8 ubTeam )
AddTopMessage( COMPUTER_TURN_MESSAGE, TeamTurnString[ ubTeam ] );
}
StartNPCAI( MercPtrs[ ubID ] );
/*if(is_server && !net_turn) send_EndTurn(ubTeam);
if(net_turn == true) net_turn = false;*/
if(is_server) send_EndTurn(ubTeam);
return;
}
}
@@ -544,7 +595,14 @@ void DisplayHiddenInterrupt( SOLDIERTYPE * pSoldier )
SlideTo( NOWHERE, pSoldier->ubID, NOBODY ,SETLOCATOR);
}
guiPendingOverrideEvent = LU_BEGINUILOCK;
if(is_client)
{
guiPendingOverrideEvent = LA_BEGINUIOURTURNLOCK;
}
else
{
guiPendingOverrideEvent = LU_BEGINUILOCK;
}
// Dirty panel interface!
fInterfacePanelDirty = DIRTYLEVEL2;
@@ -765,6 +823,10 @@ void StartInterrupt( void )
// Signal UI done enemy's turn
guiPendingOverrideEvent = LU_ENDUILOCK;
if (is_networked)
guiPendingOverrideEvent = LA_ENDUIOUTURNLOCK;
HandleTacticalUI( );
InitPlayerUIBar( TRUE );
@@ -831,7 +893,7 @@ void StartInterrupt( void )
ubFirstInterrupter = ubInterrupter;
}
}
{
// here we have to rebuilt the AI list!
BuildAIListForTeam( bTeam );
@@ -855,11 +917,16 @@ void StartInterrupt( void )
gTacticalStatus.ubCurrentTeam = pSoldier->bTeam;
#ifdef JA2BETAVERSION
//#ifdef JA2BETAVERSION
if (is_networked)
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Interrupt ( could be hidden )" );
#endif
//#endif
//send_interrupt( pSoldier );//hayden
StartNPCAI( pSoldier );
}
}
if ( !gfHiddenInterrupt )
@@ -919,7 +986,46 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
gfHiddenInterrupt = FALSE;
// resume interrupted interrupt
StartInterrupt();
//hayden
if (is_networked)
{
UINT8 nubFirstInterrupter;
INT8 nbTeam;
SOLDIERTYPE * npSoldier;
nubFirstInterrupter = LATEST_INTERRUPT_GUY;
npSoldier = MercPtrs[nubFirstInterrupter];
nbTeam = npSoldier->bTeam;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"unchecked interrupt call area:(resume interrupted interrupt)...");
if ((nbTeam > 0) && (nbTeam <6 ) && is_server) //is AI and are server
{
send_interrupt( npSoldier );
StartInterrupt();
}
else if(nbTeam == 0) //its an interrupt for own merc team
{
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"interrupt for our team");
//hayden
StartInterrupt();
send_interrupt( npSoldier ); //
}
else
{
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"interrupt for another team"); //may need more work.
//ClearIntList();
//hayden
StartInterrupt();
send_interrupt( npSoldier ); //
}
}
else
{
StartInterrupt();
}
}
else
{
@@ -1020,6 +1126,10 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
// both hidden interrupts as well - NOT good because
// hidden interrupts should leave it locked if it was already...
guiPendingOverrideEvent = LU_ENDUILOCK;
if (is_networked)
guiPendingOverrideEvent = LA_ENDUIOUTURNLOCK;
HandleTacticalUI( );
if ( gusSelectedSoldier != NOBODY )
@@ -1044,7 +1154,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
}
}
else
else if(pSoldier->bTeam < 6)//hayden : is Ai or LAN ?
{
// this could be set to true for AI-vs-AI interrupts
gfHiddenInterrupt = FALSE;
@@ -1109,7 +1219,14 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
}
// Signal UI done enemy's turn
guiPendingOverrideEvent = LU_BEGINUILOCK;
if(is_client)
{
guiPendingOverrideEvent = LA_BEGINUIOURTURNLOCK;
}
else
{
guiPendingOverrideEvent = LU_BEGINUILOCK;
}
ClearIntList();
}
@@ -1126,7 +1243,14 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
}
// Signal UI done enemy's turn
guiPendingOverrideEvent = LU_BEGINUILOCK;
if(is_client)
{
guiPendingOverrideEvent = LA_BEGINUIOURTURNLOCK;
}
else
{
guiPendingOverrideEvent = LU_BEGINUILOCK;
}
// must clear int list before ending turn
ClearIntList();
@@ -1134,6 +1258,24 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
}
}
else //its going to another Lan client..//hayden
{
gTacticalStatus.ubCurrentTeam = pSoldier->bTeam;
AddTopMessage( COMPUTER_TURN_MESSAGE, TeamTurnString[ gTacticalStatus.ubCurrentTeam ] );
if(is_client)
{
guiPendingOverrideEvent = LA_BEGINUIOURTURNLOCK;
}
else
{
guiPendingOverrideEvent = LU_BEGINUILOCK;
}
// must clear int list before ending turn
ClearIntList();
}
// Reset our interface!
fInterfacePanelDirty = DIRTYLEVEL2;
@@ -1336,7 +1478,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent
}
else
{
if ( !(pOpponent->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) && (pSoldier->bSide != pOpponent->bSide))
if ( !(is_client || (pOpponent->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL)) && (pSoldier->bSide != pOpponent->bSide))
{
return( FALSE );
}
@@ -1494,6 +1636,16 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f
iPoints--;
}
//hayden, multiplayer add advantage for a ready'd reapon
if(is_networked)
{
if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags &( ANIM_FIREREADY | ANIM_FIRE ) ))
{
iPoints=(iPoints+WEAPON_READIED_BONUS);
}
}
// if soldier is still in shock from recent injuries, that penalizes him
iPoints -= pSoldier->aiData.bShock;
@@ -1599,8 +1751,11 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN f
#ifdef DEBUG_INTERRUPTS
DebugMsg( TOPIC_JA2, 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 );
}
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CalcInterruptDuelPts done");
return( (INT8)iPoints );
}
@@ -1858,7 +2013,63 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter
}
else
{
StartInterrupt();
if (is_networked)
{
UINT8 nubFirstInterrupter;
INT8 nbTeam;
SOLDIERTYPE * npSoldier;
nubFirstInterrupter = LATEST_INTERRUPT_GUY;
npSoldier = MercPtrs[nubFirstInterrupter];
nbTeam = npSoldier->bTeam;
if ((nbTeam > 0) && (nbTeam <6 ) && is_server) //is AI and are server
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"interrupt for AI team");
send_interrupt( npSoldier );
StartInterrupt();
}
else if(nbTeam == 0 && gTacticalStatus.ubCurrentTeam == 0) //its an interrupt for own merc team && its our turn
{
//hayden
StartInterrupt();
send_interrupt( npSoldier ); //
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"interrupt for my team");
}
else if(gTacticalStatus.ubCurrentTeam == 0)//its our turn (we are moving)
{
//StartInterrupt();
send_interrupt( npSoldier ); //
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"interrupt for another team");
{
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupted" );
//stop moving merc who was interrupted and init UI bar
SOLDIERTYPE* pMerc = MercPtrs[ gusSelectedSoldier ];
//AdjustNoAPToFinishMove( pMerc, TRUE );
pMerc->HaultSoldierFromSighting(TRUE);
//pMerc->fTurningFromPronePosition = FALSE;// hmmm ??
FreezeInterfaceForEnemyTurn();
InitEnemyUIBar( 0, 0 );
fInterfacePanelDirty = DIRTYLEVEL2;
AddTopMessage( COMPUTER_TURN_MESSAGE, TeamTurnString[ nbTeam ] );
gTacticalStatus.fInterruptOccurred = TRUE;
}
//ClearIntList();
}
else
{
ClearIntList();//no interrupt to be awarded, clear generated list.
}
}
else
{
StartInterrupt();
}
}
}
}
+3
View File
@@ -4,6 +4,7 @@
#include "Soldier Control.h"
extern UINT8 gubOutOfTurnPersons;
extern UINT8 gubOutOfTurnOrder[MAXMERCS] ;
extern BOOLEAN gfHiddenInterrupt;
extern BOOLEAN gfHiddenTurnbased;
@@ -17,6 +18,7 @@ extern BOOLEAN InterruptDuel( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent);
extern void AddToIntList( UINT8 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate );
extern void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInterruptType);
void FreezeInterfaceForEnemyTurn( void );
void ClearIntList( void );
BOOLEAN SaveTeamTurnsToTheSaveGameFile( HWFILE hFile );
@@ -24,6 +26,7 @@ BOOLEAN SaveTeamTurnsToTheSaveGameFile( HWFILE hFile );
BOOLEAN LoadTeamTurnsFromTheSavedGameFile( HWFILE hFile );
void EndAllAITurns( void );
void EndTurnEvents( void );
BOOLEAN NPCFirstDraw( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier );
+101 -5
View File
@@ -117,7 +117,7 @@
#endif
#include "Quest Debug System.h"
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -188,7 +188,7 @@ BOOLEAN gfNextFireJam = FALSE;
extern INT16 ITEMDESC_START_X;
extern INT16 ITEMDESC_START_Y;
#include "fresh_header.h"
//Little functions called by keyboard input
void SwapGoggles(SOLDIERTYPE *pTeamSoldier);
@@ -1530,7 +1530,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
/// Allow to save everywhere
/// Allow to load everywhere
if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'l') )
{
if( InputEvent.usKeyState & ALT_DOWN )
@@ -1557,6 +1557,91 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
}
}
if (is_networked)
{
if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 's') )//allow saving 'always'//hayden
{
if( InputEvent.usKeyState & ALT_DOWN )
{
if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
{
//if the game CAN be saved
if( CanGameBeSaved() )
{
guiPreviousOptionScreen = GAME_SCREEN;
//guiPreviousOptionScreen = guiCurrentScreen;
DoQuickSave();
}
else
{
//Display a message saying the player cant save now
DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL );
}
}
}
else if( InputEvent.usKeyState & CTRL_DOWN )
{
if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
{
//if the game CAN be saved
if( CanGameBeSaved() )
{
gfSaveGame = TRUE;
gfCameDirectlyFromGame = TRUE;
guiPreviousOptionScreen = GAME_SCREEN;
LeaveTacticalScreen( SAVE_LOAD_SCREEN );
}
else
{
//Display a message saying the player cant save now
DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL);
}
}
}
}
if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == '0') )
{
//if( InputEvent.usKeyState & ALT_DOWN )
{
if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
{
test_func2();
}
}
}
if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'e') )
{
if( InputEvent.usKeyState & ALT_DOWN )
{
if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
{
overide_turn();
}
}
}
if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'k') )
{
if( InputEvent.usKeyState & ALT_DOWN )
{
if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
{
kick_player();
}
}
}
}
// Break of out IN CONV...
@@ -2186,7 +2271,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
}
}
else
{
ChangeCurrentSquad( 4 );
if (is_networked)
grid_display();//hayden
}
break;
case '6':
@@ -2203,10 +2293,16 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
case '9':
ChangeCurrentSquad( 8 );
if (is_networked)
cheat_func();
break;
case '0':
ChangeCurrentSquad( 9 );
if (is_networked)
//test_func2();
break;
case 'x':
@@ -3474,7 +3570,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( fAlt )
RemoveCharacterFromSquads(MercPtrs[gusSelectedSoldier]);
else if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
else if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && !is_networked)
{
//if the game CAN be saved
if( CanGameBeSaved() )
@@ -3495,7 +3591,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
else
if( fAlt )
{
if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) )
if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV )&& !is_networked )
{
//if the game CAN be saved
if( CanGameBeSaved() )
+11 -6
View File
@@ -51,7 +51,7 @@
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
#include "connect.h"
//rain
//#define WEAPON_RELIABILITY_REDUCTION_PER_RAIN_INTENSITY 0
@@ -1924,9 +1924,16 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
return( FALSE );
}
}
FireBulletGivenTarget( pSoldier, dTargetX, dTargetY, dTargetZ, pSoldier->usAttackingWeapon, (UINT16) (uiHitChance - uiDiceRoll), fBuckshot, FALSE );
//hayden
if((is_server && pSoldier->ubID<120) || (!is_server && is_client && pSoldier->ubID<20) || (!is_server && !is_client) )
{
FireBulletGivenTarget( pSoldier, dTargetX, dTargetY, dTargetZ, pSoldier->usAttackingWeapon, (UINT16) (uiHitChance - uiDiceRoll), fBuckshot, FALSE );
}
else
{
FireBulletGivenTarget( pSoldier, dTargetX, dTargetY, dTargetZ, pSoldier->usAttackingWeapon, (UINT16) (uiHitChance - uiDiceRoll), fBuckshot, TRUE );
}
//bottom one is fake (ie not in my control)
ubVolume = Weapon[ pSoldier->usAttackingWeapon ].ubAttackVolume;
@@ -5962,5 +5969,3 @@ INT8 GetAPsToReload( OBJECTTYPE *pObj )
+167
View File
@@ -40,6 +40,10 @@ BULLET gBullets[ NUM_BULLET_SLOTS ];
UINT32 guiNumBullets = 0;
BOOLEAN fTracer = FALSE;
//afp-start
int gXPATH[BULLET_TRACER_MAX_LENGTH]; // positions between bullet
int gYPATH[BULLET_TRACER_MAX_LENGTH]; // positions between bullet
//afp-end
INT32 GetFreeBullet(void)
{
@@ -106,6 +110,10 @@ INT32 CreateBullet( UINT8 ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromIt
DebugAttackBusy( String( "Creating a new bullet for %d. ABC now %d\n", ubFirerID, gTacticalStatus.ubAttackBusyCount) );
}
//afp-start each bullet carry its tail
for (int i = 0; i < BULLET_TRACER_MAX_LENGTH; i++)
pBullet->pNodes[i] = NULL;
//afp-end
return( iBulletIndex );
}
@@ -172,6 +180,15 @@ void RemoveBullet( INT32 iBullet )
{
CHECKV( iBullet < NUM_BULLET_SLOTS );
//afp-start
// remove any tail first if exists
for (int i = 0; i < BULLET_TRACER_MAX_LENGTH; i++)
if (gBullets[iBullet].pNodes[i] != NULL)
{
RemoveStructFromLevelNode(gBullets[ iBullet ].sGridNo, gBullets[iBullet].pNodes[i]);
gBullets[iBullet].pNodes[i] = NULL;
}
//afp-end
// decrease soldier's bullet count
if (gBullets[ iBullet ].fReal)
@@ -275,6 +292,18 @@ void UpdateBullets( )
RemoveStruct( gBullets[ uiCount ].sGridNo, BULLETTILE2 );
}
}
//afp-start
// remove old tail first if exists
FIXEDPT lastX = gBullets[uiCount].qCurrX;
FIXEDPT lastY = gBullets[uiCount].qCurrY;
FIXEDPT lastZ = gBullets[uiCount].qCurrZ;
for (int i = 0; i < BULLET_TRACER_MAX_LENGTH; i++)
if (gBullets[uiCount].pNodes[i] != NULL)
{
RemoveStructFromLevelNode(gBullets[ uiCount ].sGridNo, gBullets[uiCount].pNodes[i]);
gBullets[uiCount].pNodes[i] = NULL;
}
//afp-end
MoveBullet( uiCount );
if ( gBullets[ uiCount ].fToDelete )
@@ -335,7 +364,56 @@ void UpdateBullets( )
pNode->sRelativeY = (INT16) FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrY );
pNode->sRelativeZ = (INT16) CONVERT_HEIGHTUNITS_TO_PIXELS( FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrZ ) );
//afp-start - add new tail /tracer
if (gGameExternalOptions.gbBulletTracer)
{
if ((lastX != 0) || (lastY != 0))
{
// qIncrX can be used to calculate slope and make the tracer longer if necessary
PointsPath((INT16) FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrX),
(INT16) FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrY),
(INT16) FIXEDPT_TO_INT32( lastX),
(INT16) FIXEDPT_TO_INT32( lastY));
// compute valid points allong the fire line
int pointsCount = 0;
for (int i = 0; i < BULLET_TRACER_MAX_LENGTH; i++)
{
pointsCount = i;
if (gXPATH[i] == 0)
if (gYPATH[i] == 0)
break;
}
if (pointsCount <= 0)
pointsCount = 30;
for (int i = 0; i < BULLET_TRACER_MAX_LENGTH; i++)
{
if (gXPATH[i] == 0)
if (gYPATH[i] == 0)
break;
// add all points along the path between bullets as bullets
pNode = AddStructToTail( gBullets[ uiCount ].sGridNo, BULLETTILE1 );
pNode->ubShadeLevel=DEFAULT_SHADE_LEVEL;
pNode->ubNaturalShadeLevel=DEFAULT_SHADE_LEVEL;
pNode->uiFlags |= ( LEVELNODE_USEABSOLUTEPOS | LEVELNODE_IGNOREHEIGHT );
pNode->sRelativeX = gXPATH[i];
pNode->sRelativeY = gYPATH[i];
FIXEDPT relativeZ = lastZ - ((i + 1) * ((gBullets[ uiCount ].qCurrZ - lastZ) / (pointsCount)));
pNode->sRelativeZ = (INT16) CONVERT_HEIGHTUNITS_TO_PIXELS( FIXEDPT_TO_INT32( relativeZ));
// store structure pointer to clear image at the next bullet position
gBullets[uiCount].pNodes[i] = pNode;
}
}
}
//afp-end
// Display shadow
// afp - no more shadow if tracer enabled
if (!gGameExternalOptions.gbBulletTracer)
{
pNode = AddStructToTail( gBullets[ uiCount ].sGridNo, BULLETTILE2 );
pNode->ubShadeLevel=DEFAULT_SHADE_LEVEL;
pNode->ubNaturalShadeLevel=DEFAULT_SHADE_LEVEL;
@@ -343,6 +421,7 @@ void UpdateBullets( )
pNode->sRelativeX = (INT16) FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrX );
pNode->sRelativeY = (INT16) FIXEDPT_TO_INT32( gBullets[ uiCount ].qCurrY );
pNode->sRelativeZ = (INT16)gpWorldLevelData[ gBullets[ uiCount ].sGridNo ].sHeight;
}
}
}
}
@@ -582,3 +661,91 @@ void DeleteAllBullets( )
RecountBullets( );
}
//afp-start adapted function, no much time for cosmetics
void PointsPath(int sx1, int sy1, int ex2, int ey2)
{
for (int i = 0; i < BULLET_TRACER_MAX_LENGTH; i++)
{
gXPATH[i] = 0;
gYPATH[i] = 0;
}
int counter = 0;
gXPATH[counter] = sx1;
gYPATH[counter] = sy1;
int x0 = sx1;
int y0 = sy1;
int x1 = ex2;
int y1 = ey2;
int dy = y1 - y0;
int dx = x1 - x0;
int stepx, stepy;
int gridX, gridY;
if (dy < 0)
{
dy = -dy;
stepy = -1;
}
else
stepy = 1;
if (dx < 0)
{
dx = -dx;
stepx = -1;
}
else
stepx = 1;
dy <<= 1;
dx <<= 1;
gridX = x0 >> 3;
gridY = y0 >> 3;
if ((sx1==ex2) &&(sy1=ey2))
return;
if (dx > dy)
{
int fraction = dy - (dx >> 1);
while (x0 != x1)
{
if (fraction >= 0)
{
y0 += stepy;
fraction -= dx;
}
x0 += stepx;
fraction += dy;
counter++;
if (counter >= BULLET_TRACER_MAX_LENGTH)
return;
gXPATH[counter] = x0;
gYPATH[counter] = y0;
}
}
else
{
int fraction = dx - (dy >> 1);
while (y0 != y1)
{
if (fraction >= 0)
{
x0 += stepx;
fraction -= dy;
}
y0 += stepy;
fraction += dx;
counter++;
if (counter >= BULLET_TRACER_MAX_LENGTH)
return;
gXPATH[counter] = x0;
gYPATH[counter] = y0;
}
}
return;
}
//afp-end