Fix AI deadlock when multiple soldiers occupy the same tile

Fix to reset Pablo so that future thefts can also be punished


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1169 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-08-07 05:10:05 +00:00
parent f5e3e7d7ff
commit 6de05c3fe1
9 changed files with 1702 additions and 1691 deletions
+1 -1
View File
@@ -2307,7 +2307,7 @@ BOOLEAN AddNewBobbyRShipment( BobbyRayPurchaseStruct *pPurchaseStruct, UINT8 ubD
else else
gpNewBobbyrShipments[ iFoundSpot ].fDisplayedInShipmentPage = FALSE; gpNewBobbyrShipments[ iFoundSpot ].fDisplayedInShipmentPage = FALSE;
//get the apckage weight, if the weight is "below" the minimum, use the minimum //get the package weight, if the weight is "below" the minimum, use the minimum
if( uiPackageWeight < MIN_SHIPPING_WEIGHT ) if( uiPackageWeight < MIN_SHIPPING_WEIGHT )
{ {
gpNewBobbyrShipments[ iFoundSpot ].uiPackageWeight = MIN_SHIPPING_WEIGHT; gpNewBobbyrShipments[ iFoundSpot ].uiPackageWeight = MIN_SHIPPING_WEIGHT;
-2
View File
@@ -1601,8 +1601,6 @@ void SimulateMouseMovement( UINT32 uiNewXPos, UINT32 uiNewYPos )
newmouse.y = uiNewYPos; newmouse.y = uiNewYPos;
ClientToScreen( ghWindow, &newmouse); ClientToScreen( ghWindow, &newmouse);
SetCursorPos( newmouse.x, newmouse.y); SetCursorPos( newmouse.x, newmouse.y);
// Does this generate a mouse move message? I'll first try without
} }
+2
View File
@@ -342,6 +342,8 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
SetFactFalse( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT ); SetFactFalse( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT );
} }
SetFactFalse( FACT_PLAYER_FOUND_ITEMS_MISSING );
SetFactFalse( FACT_LARGE_SIZED_OLD_SHIPMENT_WAITING ); SetFactFalse( FACT_LARGE_SIZED_OLD_SHIPMENT_WAITING );
if ( CheckFact( FACT_NEXT_PACKAGE_CAN_BE_DELAYED, 0 ) ) if ( CheckFact( FACT_NEXT_PACKAGE_CAN_BE_DELAYED, 0 ) )
+1553 -1553
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -7224,6 +7224,10 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp
else if (pTarget->ubProfile == PABLO && pTarget->bLife >= OKLIFE && CheckFact( FACT_PABLO_PUNISHED_BY_PLAYER, 0 ) && !CheckFact( 38, 0 ) ) else if (pTarget->ubProfile == PABLO && pTarget->bLife >= OKLIFE && CheckFact( FACT_PABLO_PUNISHED_BY_PLAYER, 0 ) && !CheckFact( 38, 0 ) )
{ {
TriggerNPCRecord( PABLO, 3 ); TriggerNPCRecord( PABLO, 3 );
// Nailed Pablo. So reset the fact that he stole from the last shipment since he's supposed to be returning
// the goods now.
SetFactFalse( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT);
SetFactFalse( FACT_PLAYER_FOUND_ITEMS_MISSING);
} }
else else
{ {
+132 -131
View File
@@ -279,7 +279,7 @@ Inventory& Inventory::operator=(const Inventory& src)
// This IF is just for setting breakpoints when trying to figure out inventory item problems. Remove it later // This IF is just for setting breakpoints when trying to figure out inventory item problems. Remove it later
if ((src.inv.size() != slotCnt) || if ((src.inv.size() != slotCnt) ||
(inv.size() != slotCnt)) { (inv.size() != slotCnt)) {
int i = 0; // Set BP here if following asserts throw int i = 0; // Set BP here if following asserts throw
} }
Assert (src.inv.size() == slotCnt); Assert (src.inv.size() == slotCnt);
Assert (inv.size() == slotCnt); Assert (inv.size() == slotCnt);
@@ -295,8 +295,8 @@ Inventory& Inventory::operator=(const Inventory& src)
inv[idx] = src.inv[idx]; inv[idx] = src.inv[idx];
} }
} }
} }
return *this; return *this;
} }
Inventory::~Inventory() { Inventory::~Inventory() {
@@ -308,7 +308,7 @@ OBJECTTYPE& Inventory::operator [] (int idx) {
if ((idx < 0) || if ((idx < 0) ||
(idx >= slotCnt) || (idx >= slotCnt) ||
(inv.size() != slotCnt)) { (inv.size() != slotCnt)) {
int i = inv.size(); // Set BP here if following asserts throw int i = inv.size(); // Set BP here if following asserts throw
} }
Assert(idx >= 0); Assert(idx >= 0);
Assert(idx < slotCnt); Assert(idx < slotCnt);
@@ -357,13 +357,13 @@ SOLDIERTYPE::SOLDIERTYPE(const SOLDIERTYPE& src) {
// Assignment operator // Assignment operator
SOLDIERTYPE& SOLDIERTYPE::operator=(const SOLDIERTYPE& src) SOLDIERTYPE& SOLDIERTYPE::operator=(const SOLDIERTYPE& src)
{ {
if (this != &src) { if (this != &src) {
memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD); memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD);
inv = src.inv; inv = src.inv;
bNewItemCount = src.bNewItemCount; bNewItemCount = src.bNewItemCount;
bNewItemCycleCount = src.bNewItemCycleCount; bNewItemCycleCount = src.bNewItemCycleCount;
} }
return *this; return *this;
} }
// Destructor // Destructor
@@ -554,13 +554,13 @@ MERCPROFILESTRUCT::MERCPROFILESTRUCT(const MERCPROFILESTRUCT& src) {
// Assignment operator // Assignment operator
MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const MERCPROFILESTRUCT& src) MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const MERCPROFILESTRUCT& src)
{ {
if (this != &src) { if (this != &src) {
memcpy(this, &src, SIZEOF_MERCPROFILESTRUCT_POD); memcpy(this, &src, SIZEOF_MERCPROFILESTRUCT_POD);
inv = src.inv; inv = src.inv;
bInvStatus = src.bInvStatus; bInvStatus = src.bInvStatus;
bInvNumber = src.bInvNumber; bInvNumber = src.bInvNumber;
} }
Assert(inv.size() == NUM_INV_SLOTS); Assert(inv.size() == NUM_INV_SLOTS);
Assert(bInvStatus.size() == NUM_INV_SLOTS); Assert(bInvStatus.size() == NUM_INV_SLOTS);
Assert(bInvStatus.size() == NUM_INV_SLOTS); Assert(bInvStatus.size() == NUM_INV_SLOTS);
return *this; return *this;
@@ -3978,7 +3978,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady )
void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGrid ) void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGrid )
{ {
UINT8 ubCombinedLoss, ubVolume, ubReason; UINT8 ubCombinedLoss, ubVolume, ubReason;
// SOLDIERTYPE * pNewSoldier; // SOLDIERTYPE * pNewSoldier;
ubReason = 0; ubReason = 0;
@@ -3989,17 +3989,17 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
// ATE: If we have gotten hit, but are still in our attack animation, reduce count! // ATE: If we have gotten hit, but are still in our attack animation, reduce count!
switch ( pSoldier->usAnimState ) switch ( pSoldier->usAnimState )
{ {
case SHOOT_ROCKET: case SHOOT_ROCKET:
case SHOOT_MORTAR: case SHOOT_MORTAR:
case THROW_ITEM: case THROW_ITEM:
// <SB> crouch throwing // <SB> crouch throwing
case THROW_ITEM_CROUCHED: case THROW_ITEM_CROUCHED:
// <SB> crouch throwing // <SB> crouch throwing
case LOB_ITEM: case LOB_ITEM:
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY HIT ANIMATION, Now %d", gAnimControl[ pSoldier->usAnimState ].zAnimStr, gTacticalStatus.ubAttackBusyCount ) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY HIT ANIMATION, Now %d", gAnimControl[ pSoldier->usAnimState ].zAnimStr, gTacticalStatus.ubAttackBusyCount ) );
ReduceAttackBusyCount( pSoldier->ubID, FALSE ); ReduceAttackBusyCount( pSoldier->ubID, FALSE );
break; break;
} }
#endif #endif
@@ -5072,7 +5072,9 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid
#endif #endif
iDest = FindBestPath( pSoldier, sDestGridNo, pSoldier->bLevel, usMovementAnim, COPYROUTE, fFlags ); iDest = FindBestPath( pSoldier, sDestGridNo, pSoldier->bLevel, usMovementAnim, COPYROUTE, fFlags );
fContinue = (iDest != 0); fContinue = (iDest != 0);
// } #if 0
}
#endif
// Only if we can get a path here // Only if we can get a path here
if ( fContinue ) if ( fContinue )
@@ -5253,8 +5255,8 @@ void ChangeSoldierStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance )
// Now change to appropriate animation // Now change to appropriate animation
EVENT_InitNewSoldierAnim( pSoldier, usNewState, 0 , FALSE ); EVENT_InitNewSoldierAnim( pSoldier, usNewState, 0 , FALSE );
}
} }
}
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState ) void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState )
{ {
@@ -6115,22 +6117,24 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
// This is needed for prone animations as well as any multi-tiled structs // This is needed for prone animations as well as any multi-tiled structs
if ( fDoDirectionChange ) if ( fDoDirectionChange )
{ {
// If the soldier is not crawling or multi-tiled, he should be allowed to turn in place. Even if there is some
// obstacle he shouldn't be standing on.
if ( OKToAddMercToWorld( pSoldier, (INT8)sDirection ) ) if ( OKToAddMercToWorld( pSoldier, (INT8)sDirection ) )
{ {
// Don't do this if we are walkoing off screen... // Don't do this if we are walkoing off screen...
if ( gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALKOFF_SCREEN || gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO ) if ( gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALKOFF_SCREEN || gubWaitingForAllMercsToExitCode == WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO )
{ {
} }
else else
{ {
// ATE: We should only do this if we are STATIONARY! // ATE: We should only do this if we are STATIONARY!
if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) ) if ( ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) )
{ {
pSoldier->uiStatusFlags |= SOLDIER_LOOK_NEXT_TURNSOLDIER; pSoldier->uiStatusFlags |= SOLDIER_LOOK_NEXT_TURNSOLDIER;
} }
// otherwise, it's handled next tile... // otherwise, it's handled next tile...
} }
EVENT_SetSoldierDirection( pSoldier, sDirection ); EVENT_SetSoldierDirection( pSoldier, sDirection );
@@ -6139,22 +6143,19 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
PlaySoldierFootstepSound( pSoldier ); PlaySoldierFootstepSound( pSoldier );
} }
} }
else
{
// Are we prone crawling? // Are we prone crawling?
if ( pSoldier->usAnimState == CRAWLING ) else if ( pSoldier->usAnimState == CRAWLING )
{ {
// OK, we want to getup, turn and go prone again.... // OK, we want to getup, turn and go prone again....
SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH ); SendChangeSoldierStanceEvent( pSoldier, ANIM_CROUCH );
pSoldier->fTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE; pSoldier->fTurningFromPronePosition = TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE;
}
// If we are a creature, or multi-tiled, cancel AI action.....?
else if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
{
pSoldier->bDesiredDirection = pSoldier->bDirection;
}
} }
// If we are a creature, or multi-tiled, cancel AI action.....?
else if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
{
pSoldier->bDesiredDirection = pSoldier->bDirection;
}
} }
} }
@@ -7003,26 +7004,26 @@ void BeginSoldierClimbUpRoof( SOLDIERTYPE *pSoldier )
//Kaiden: Helps if we look where we are going before we try to climb on top of someone //Kaiden: Helps if we look where we are going before we try to climb on top of someone
ubWhoIsThere = WhoIsThere2( NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 1 ); ubWhoIsThere = WhoIsThere2( NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 1 );
if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID ) if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID )
{ {
return; return;
} }
else else
{ {
if (pSoldier->bTeam == gbPlayerNum) if (pSoldier->bTeam == gbPlayerNum)
{ {
// OK, SET INTERFACE FIRST // OK, SET INTERFACE FIRST
SetUIBusy( pSoldier->ubID ); SetUIBusy( pSoldier->ubID );
} }
pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) );
pSoldier->ubPendingDirection = bNewDirection; pSoldier->ubPendingDirection = bNewDirection;
//pSoldier->usPendingAnimation = CLIMBUPROOF; //pSoldier->usPendingAnimation = CLIMBUPROOF;
EVENT_InitNewSoldierAnim( pSoldier, CLIMBUPROOF, 0 , FALSE ); EVENT_InitNewSoldierAnim( pSoldier, CLIMBUPROOF, 0 , FALSE );
InternalReceivingSoldierCancelServices( pSoldier, FALSE ); InternalReceivingSoldierCancelServices( pSoldier, FALSE );
InternalGivingSoldierCancelServices( pSoldier, FALSE ); InternalGivingSoldierCancelServices( pSoldier, FALSE );
} }
@@ -8269,30 +8270,30 @@ void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier )
//Kaiden: Helps if we look where we are going before we try to climb on top of someone //Kaiden: Helps if we look where we are going before we try to climb on top of someone
ubWhoIsThere = WhoIsThere2( NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 0 ); ubWhoIsThere = WhoIsThere2( NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 0 );
if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID ) if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID )
{ {
return; return;
} }
else else
{ {
if (pSoldier->bTeam == gbPlayerNum) if (pSoldier->bTeam == gbPlayerNum)
{ {
// OK, SET INTERFACE FIRST // OK, SET INTERFACE FIRST
SetUIBusy( pSoldier->ubID ); SetUIBusy( pSoldier->ubID );
} }
pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ); pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) );
bNewDirection = gTwoCDirection[ bNewDirection ]; bNewDirection = gTwoCDirection[ bNewDirection ];
pSoldier->ubPendingDirection = bNewDirection; pSoldier->ubPendingDirection = bNewDirection;
EVENT_InitNewSoldierAnim( pSoldier, CLIMBDOWNROOF, 0 , FALSE ); EVENT_InitNewSoldierAnim( pSoldier, CLIMBDOWNROOF, 0 , FALSE );
InternalReceivingSoldierCancelServices( pSoldier, FALSE ); InternalReceivingSoldierCancelServices( pSoldier, FALSE );
InternalGivingSoldierCancelServices( pSoldier, FALSE ); InternalGivingSoldierCancelServices( pSoldier, FALSE );
} }
} }
@@ -8940,7 +8941,7 @@ void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier )
ubNumToFree = pSoldier->bBeingAttackedCount; ubNumToFree = pSoldier->bBeingAttackedCount;
// Zero it out BEFORE, as supression may increase it again... // Zero it out BEFORE, as supression may increase it again...
pSoldier->bBeingAttackedCount = 0; pSoldier->bBeingAttackedCount = 0;
for ( cnt = 0; cnt < ubNumToFree; cnt++ ) for ( cnt = 0; cnt < ubNumToFree; cnt++ )
{ {
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker of %d (attacker is %d) - releasesoldierattacker num to free is %d", pSoldier->ubID, pSoldier->ubAttackerID, ubNumToFree ) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker of %d (attacker is %d) - releasesoldierattacker num to free is %d", pSoldier->ubID, pSoldier->ubAttackerID, ubNumToFree ) );
@@ -9213,7 +9214,7 @@ void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8
// Increment the number of people busy doing stuff because of an attack // Increment the number of people busy doing stuff because of an attack
//if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
//{ //{
// gTacticalStatus.ubAttackBusyCount++; // gTacticalStatus.ubAttackBusyCount++;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Begin blade attack: ATB %d", gTacticalStatus.ubAttackBusyCount) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Begin blade attack: ATB %d", gTacticalStatus.ubAttackBusyCount) );
DebugAttackBusy( String( "Begin blade attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) ); DebugAttackBusy( String( "Begin blade attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) );
@@ -9389,7 +9390,7 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8
// Increment the number of people busy doing stuff because of an attack // Increment the number of people busy doing stuff because of an attack
//if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
//{ //{
// gTacticalStatus.ubAttackBusyCount++; // gTacticalStatus.ubAttackBusyCount++;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Begin HTH attack: ATB %d", gTacticalStatus.ubAttackBusyCount) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Begin HTH attack: ATB %d", gTacticalStatus.ubAttackBusyCount) );
DebugAttackBusy( String( "Begin HTH attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) ); DebugAttackBusy( String( "Begin HTH attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) );
@@ -9512,9 +9513,9 @@ void EVENT_SoldierBeginKnifeThrowAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, U
// Increment the number of people busy doing stuff because of an attack // Increment the number of people busy doing stuff because of an attack
//if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) //if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
//{ //{
// gTacticalStatus.ubAttackBusyCount++; // gTacticalStatus.ubAttackBusyCount++;
//} //}
// pSoldier->bBulletsLeft = 1; // pSoldier->bBulletsLeft = 1;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting knifethrow attack, bullets left %d", pSoldier->bBulletsLeft) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting knifethrow attack, bullets left %d", pSoldier->bBulletsLeft) );
DebugAttackBusy( String( "Begin knife throwing attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) ); DebugAttackBusy( String( "Begin knife throwing attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) );
@@ -10730,58 +10731,58 @@ INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
{ {
// may drop blood whether or not any bleeding takes place this turn // may drop blood whether or not any bleeding takes place this turn
if ( pSoldier->bTilesMoved < 1 ) if ( pSoldier->bTilesMoved < 1 )
{ {
iBlood = ( ( pSoldier->bBleeding - MIN_BLEEDING_THRESHOLD ) / BLOODDIVISOR ); // + pSoldier->dying; iBlood = ( ( pSoldier->bBleeding - MIN_BLEEDING_THRESHOLD ) / BLOODDIVISOR ); // + pSoldier->dying;
if ( iBlood > MAXBLOODQUANTITY ) if ( iBlood > MAXBLOODQUANTITY )
{ {
iBlood = MAXBLOODQUANTITY; iBlood = MAXBLOODQUANTITY;
} }
} }
else else
{ {
iBlood = NOBLOOD; iBlood = NOBLOOD;
} }
// Are we in a different mode? // Are we in a different mode?
if ( !(gTacticalStatus.uiFlags & TURNBASED ) || !(gTacticalStatus.uiFlags & INCOMBAT ) ) if ( !(gTacticalStatus.uiFlags & TURNBASED ) || !(gTacticalStatus.uiFlags & INCOMBAT ) )
{ {
pSoldier->dNextBleed -= (FLOAT)RT_NEXT_BLEED_MODIFIER; pSoldier->dNextBleed -= (FLOAT)RT_NEXT_BLEED_MODIFIER;
} }
else else
{ {
// Do a single step descrease // Do a single step descrease
pSoldier->dNextBleed--; pSoldier->dNextBleed--;
} }
// if it's time to lose some blood // if it's time to lose some blood
if ( pSoldier->dNextBleed <= 0) if ( pSoldier->dNextBleed <= 0)
{ {
// first, calculate if soldier is bandaged // first, calculate if soldier is bandaged
bBandaged = pSoldier->bLifeMax - pSoldier->bBleeding - pSoldier->bLife; bBandaged = pSoldier->bLifeMax - pSoldier->bBleeding - pSoldier->bLife;
// as long as he's bandaged and not "dying" // as long as he's bandaged and not "dying"
if ( bBandaged && pSoldier->bLife >= OKLIFE ) if ( bBandaged && pSoldier->bLife >= OKLIFE )
{ {
// just bleeding through existing bandages // just bleeding through existing bandages
pSoldier->bBleeding++; pSoldier->bBleeding++;
SoldierBleed( pSoldier, TRUE ); SoldierBleed( pSoldier, TRUE );
} }
else // soldier is either not bandaged at all or is dying else // soldier is either not bandaged at all or is dying
{ {
if ( pSoldier->bLife < OKLIFE ) // if he's dying if ( pSoldier->bLife < OKLIFE ) // if he's dying
{ {
// if he's conscious, and he hasn't already, say his "dying quote" // if he's conscious, and he hasn't already, say his "dying quote"
if ( ( pSoldier->bLife >= CONSCIOUSNESS ) && !pSoldier->fDyingComment ) if ( ( pSoldier->bLife >= CONSCIOUSNESS ) && !pSoldier->fDyingComment )
{ {
TacticalCharacterDialogue( pSoldier, QUOTE_SERIOUSLY_WOUNDED ); TacticalCharacterDialogue( pSoldier, QUOTE_SERIOUSLY_WOUNDED );
pSoldier->fDyingComment = TRUE; pSoldier->fDyingComment = TRUE;
} }
// can't permit lifemax to ever bleed beneath OKLIFE, or that // can't permit lifemax to ever bleed beneath OKLIFE, or that
// soldier might as well be dead! // soldier might as well be dead!
if (pSoldier->bLifeMax >= OKLIFE) if (pSoldier->bLifeMax >= OKLIFE)
{ {
// bleeding while "dying" costs a PERMANENT point of life each time! // bleeding while "dying" costs a PERMANENT point of life each time!
pSoldier->bLifeMax--; pSoldier->bLifeMax--;
@@ -10790,16 +10791,16 @@ INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
} }
} }
// either way, a point of life (health) is lost because of bleeding // either way, a point of life (health) is lost because of bleeding
// This will also update the life bar // This will also update the life bar
SoldierBleed( pSoldier, FALSE ); SoldierBleed( pSoldier, FALSE );
// if he's not dying (which includes him saying the dying quote just // if he's not dying (which includes him saying the dying quote just
// now), and he hasn't warned us that he's bleeding yet, he does so // now), and he hasn't warned us that he's bleeding yet, he does so
// Also, not if they are being bandaged.... // Also, not if they are being bandaged....
if ( ( pSoldier->bLife >= OKLIFE ) && !pSoldier->fDyingComment && !pSoldier->fWarnedAboutBleeding && !gTacticalStatus.fAutoBandageMode && pSoldier->ubServiceCount == 0 ) if ( ( pSoldier->bLife >= OKLIFE ) && !pSoldier->fDyingComment && !pSoldier->fWarnedAboutBleeding && !gTacticalStatus.fAutoBandageMode && pSoldier->ubServiceCount == 0 )
{ {
TacticalCharacterDialogue( pSoldier, QUOTE_STARTING_TO_BLEED ); TacticalCharacterDialogue( pSoldier, QUOTE_STARTING_TO_BLEED );
@@ -10807,7 +10808,7 @@ INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
pSoldier->fWarnedAboutBleeding = TRUE; pSoldier->fWarnedAboutBleeding = TRUE;
} }
pSoldier->dNextBleed = CalcSoldierNextBleed( pSoldier ); pSoldier->dNextBleed = CalcSoldierNextBleed( pSoldier );
} }
} }
@@ -11574,7 +11575,7 @@ void MercStealFromMerc( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTarget )
} }
// OK, set UI // OK, set UI
// gTacticalStatus.ubAttackBusyCount++; // gTacticalStatus.ubAttackBusyCount++;
// reset attacking item (hand) // reset attacking item (hand)
pSoldier->usAttackingWeapon = 0; pSoldier->usAttackingWeapon = 0;
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting STEAL attack, attack count now %d", gTacticalStatus.ubAttackBusyCount) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("!!!!!!! Starting STEAL attack, attack count now %d", gTacticalStatus.ubAttackBusyCount) );
@@ -12277,7 +12278,7 @@ void SetSoldierPersonalLightLevel( SOLDIERTYPE *pSoldier )
return; return;
} }
//THe light level for the soldier //The light level for the soldier
gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubShadeLevel = 3; gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubShadeLevel = 3;
gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubSumLights = 5; gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubSumLights = 5;
gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubMaxLights = 5; gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubMaxLights = 5;
+4 -2
View File
@@ -252,8 +252,10 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo )
{ {
if ( sGridNo == BOBBYR_SHIPPING_DEST_GRIDNO && gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X && gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y && gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z && CheckFact( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT, 0 ) && !(CheckFact( FACT_PLAYER_FOUND_ITEMS_MISSING, 0) ) ) if ( sGridNo == BOBBYR_SHIPPING_DEST_GRIDNO && gWorldSectorX == BOBBYR_SHIPPING_DEST_SECTOR_X && gWorldSectorY == BOBBYR_SHIPPING_DEST_SECTOR_Y && gbWorldSectorZ == BOBBYR_SHIPPING_DEST_SECTOR_Z && CheckFact( FACT_PABLOS_STOLE_FROM_LATEST_SHIPMENT, 0 ) && !(CheckFact( FACT_PLAYER_FOUND_ITEMS_MISSING, 0) ) )
{ {
SayQuoteFromNearbyMercInSector( BOBBYR_SHIPPING_DEST_GRIDNO, 3, QUOTE_STUFF_MISSING_DRASSEN ); SetFactFalse( 38); // Reset whether we punched Pablo lately
fDidMissingQuote = TRUE; SetFactFalse( FACT_PABLO_RETURNED_GOODS);
SayQuoteFromNearbyMercInSector( BOBBYR_SHIPPING_DEST_GRIDNO, 3, QUOTE_STUFF_MISSING_DRASSEN );
fDidMissingQuote = TRUE;
} }
} }
else if ( pSoldier->bTeam == CIV_TEAM ) else if ( pSoldier->bTeam == CIV_TEAM )
+5 -1
View File
@@ -2263,7 +2263,11 @@ BOOLEAN OKToAddMercToWorld( SOLDIERTYPE *pSoldier, INT8 bDirection )
STRUCTURE_FILE_REF *pStructFileRef; STRUCTURE_FILE_REF *pStructFileRef;
UINT16 usOKToAddStructID; UINT16 usOKToAddStructID;
//if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ) // 0verhaul: Reinserting this check. If a soldier is sitting or standing on a grid and another soldier is lying prone
// across that grid but has the structure, this call will not allow the current soldier to turn. Since we are talking
// about the soldier whose turn it is, this is not a good thing because it will lead to deadlock.
if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE ||
pSoldier->usAnimState == CRAWLING)
{ {
// Get surface data // Get surface data
usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState );
+1 -1
View File
@@ -142,7 +142,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib" AdditionalDependencies="Winmm.lib"
OutputFile="$(OutDir)\ja2_rel._1066.exe" OutputFile="$(OutDir)\ja2_rel_1066.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"