****************************************************************************

** Merged Source Code from Development trunk, for the Spring 2011 Release **
****************************************************************************
o Development Trunk (Revision: 4444):  https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
o This trunk (the official 1.13 source trunk) will only be used for fixing bugs. No new features will be added here.
  New Features are only included in the Development trunk
o !!! After we have fixed a bug here in this trunk, we should MANUALLY merge the bugfix in the development trunk !!!

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4446 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-05-26 11:04:47 +00:00
parent c999420bb7
commit 6e2bdd557c
191 changed files with 17816 additions and 6106 deletions
+156 -95
View File
@@ -2413,8 +2413,12 @@ BOOLEAN SOLDIERTYPE::CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID,
// bad anims are: HOPFENCE,
// CLIMBDOWNROOF, FALLFORWARD_ROOF,FALLOFF, CLIMBUPROOF
if( !gfWorldLoaded &&
( usState == HOPFENCE ||
( usState == HOPFENCE || usState == JUMPWINDOWS ||
usState == CLIMBDOWNROOF ||
usState == JUMPDOWNWALL ||
usState == JUMPUPWALL ||
usState == FALLFORWARD_ROOF ||
usState == FALLOFF ||
usState == CLIMBUPROOF ) )
@@ -2992,6 +2996,33 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
return( TRUE );
}
}
if ( usNewState == JUMPUPWALL )
{
if ( this->ubPendingDirection != NO_PENDING_DIRECTION )
{
this->EVENT_SetSoldierDesiredDirection( this->ubPendingDirection );
this->ubPendingDirection = NO_PENDING_DIRECTION;
this->usPendingAnimation = JUMPUPWALL;
this->flags.fTurningUntilDone = TRUE;
this->SoldierGotoStationaryStance( );
return( TRUE );
}
}
if ( usNewState == JUMPDOWNWALL )
{
if ( this->ubPendingDirection != NO_PENDING_DIRECTION )
{
this->EVENT_SetSoldierDesiredDirection( this->ubPendingDirection );
this->ubPendingDirection = NO_PENDING_DIRECTION;
this->usPendingAnimation = JUMPDOWNWALL;
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF;
this->flags.fTurningUntilDone = TRUE;
this->SoldierGotoStationaryStance( );
return( TRUE );
}
}
// ATE: Don't raise/lower automatically if we are low on health,
// as our gun looks lowered anyway....
@@ -3229,7 +3260,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
}
// ATE: Patch hole for breath collapse for roofs, fences
if ( usNewState == CLIMBUPROOF || usNewState == CLIMBDOWNROOF || usNewState == HOPFENCE )
if ( usNewState == JUMPUPWALL || usNewState == JUMPDOWNWALL || usNewState == CLIMBUPROOF || usNewState == CLIMBDOWNROOF || usNewState == HOPFENCE || usNewState == JUMPWINDOWS)
{
// Check for breath collapse if a given animation like
if ( this->CheckForBreathCollapse( ) || this->bCollapsed )
@@ -3708,6 +3739,13 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
else
DeductPoints( this, GetAPsToJumpFence( this, FALSE ), GetBPsToJumpFence( this, FALSE ) );
break;
case JUMPWINDOWS:
if((UsingNewInventorySystem() == true) && FindBackpackOnSoldier( this ) != ITEM_NOT_FOUND )
DeductPoints( this, GetAPsToJumpThroughWindows( this, TRUE ), GetBPsToJumpThroughWindows( this, TRUE ) );
else
DeductPoints( this, GetAPsToJumpThroughWindows( this, FALSE ), GetBPsToJumpThroughWindows( this, FALSE ) );
break;
// Deduct aps for falling down....
case FALLBACK_HIT_STAND:
@@ -3742,6 +3780,22 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
DeductPoints( this, GetAPsToClimbRoof( this, FALSE), GetBPsToClimbRoof( this, FALSE) ); // changed by SANDRO
break;
case JUMPDOWNWALL:
// disable sight
gTacticalStatus.uiFlags |= DISALLOW_SIGHT;
DeductPoints( this, GetAPsToJumpWall( this, TRUE), GetBPsToJumpWall( this, TRUE) );
break;
case JUMPUPWALL:
// disable sight
gTacticalStatus.uiFlags |= DISALLOW_SIGHT;
DeductPoints( this, GetAPsToJumpWall( this, FALSE), GetBPsToJumpWall( this, FALSE) );
break;
case JUMP_OVER_BLOCKING_PERSON:
@@ -4311,6 +4365,17 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove )
if(this->iLight!=(-1))
LightSpriteRoofStatus(this->iLight, FALSE );
}
if ( this->usAnimState == JUMPUPWALL )
{
if(this->iLight!=(-1))
LightSpriteRoofStatus(this->iLight, TRUE );
}
else if ( this->usAnimState == JUMPDOWNWALL )
{
if(this->iLight!=(-1))
LightSpriteRoofStatus(this->iLight, FALSE );
}
//JA2Gold:
//if the player wants the merc to cast the fake light AND it is night
@@ -6583,7 +6648,7 @@ void SOLDIERTYPE::EVENT_InternalSetSoldierDestination( UINT16 usNewDirection, BO
// OK, ATE: If we are side_stepping, calculate a NEW desired direction....
if ( this->bReverse && usAnimState == SIDE_STEP )
if ( this->bReverse && (usAnimState == SIDE_STEP || usAnimState == ROLL_PRONE_R || usAnimState == ROLL_PRONE_L) )
{
UINT8 ubPerpDirection;
@@ -6691,7 +6756,7 @@ INT8 MultiTiledTurnDirection( SOLDIERTYPE * pSoldier, INT8 bStartDirection, INT8
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState )
{
//if ( usAnimState == WALK_BACKWARDS )
if ( pSoldier->bReverse && usAnimState != SIDE_STEP )
if ( pSoldier->bReverse && (usAnimState != SIDE_STEP && usAnimState != ROLL_PRONE_R && usAnimState != ROLL_PRONE_L) )
{
// OK, check if we are going to go in the exact opposite than our facing....
ubNewDirection = gOppositeDirection[ ubNewDirection ];
@@ -7245,6 +7310,19 @@ void SOLDIERTYPE::TurnSoldier( void )
HandleSystemNewAISituation( this, FALSE );
}
if ( this->flags.uiStatusFlags & SOLDIER_LOOK_NEXT_TURNSOLDIER )
{
if ( ( gAnimControl[ this->usAnimState ].uiFlags & ANIM_STATIONARY && this->usAnimState != JUMPUPWALL && this->usAnimState != JUMPDOWNWALL ) )
{
// HANDLE SIGHT!
HandleSight( this,SIGHT_LOOK | SIGHT_RADIO );
}
// Turn off!
this->flags.uiStatusFlags &= (~SOLDIER_LOOK_NEXT_TURNSOLDIER );
HandleSystemNewAISituation( this, FALSE );
}
if ( this->flags.fTurningToShoot )
@@ -8480,7 +8558,7 @@ void SOLDIERTYPE::BeginSoldierClimbFence( void )
void SOLDIERTYPE::BeginSoldierClimbWindow( void )
{
INT8 bDirection;
INT8 bDirection;
// Make sure we hop the correct fence to follow our path!
if (this->pathing.usPathIndex < this->pathing.usPathDataSize)
@@ -8500,59 +8578,55 @@ void SOLDIERTYPE::BeginSoldierClimbWindow( void )
this->flags.fTurningUntilDone = TRUE;
// ATE: Reset flag to go back to prone...
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF;
this->usPendingAnimation = HOPFENCE;
this->usPendingAnimation = JUMPWINDOWS; //HOPFENCE;
}
}
void SOLDIERTYPE::BeginSoldierFence( void )
void SOLDIERTYPE::BeginSoldierClimbWall( void )
{
INT8 bNewDirection;
UINT8 ubWhoIsThere;
if ( FindFenceDirection( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel == 0 ) )
if ( FindWallJumpDirection( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel == 0 ) )
{
if ( EnoughPoints( this, GetAPsToClimbRoof( this, FALSE ), 0, TRUE ) )
{
//Kaiden: Helps if we look where we are going before we try to climb on top of someone
ubWhoIsThere = WhoIsThere2( NewGridNo( this->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 1 );
if ( ubWhoIsThere != NOBODY && ubWhoIsThere != this->ubID )
{
return;
}
else
{
if (this->bTeam == gbPlayerNum)
ubWhoIsThere = WhoIsThere2( NewGridNo( this->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 1 );
if ( ubWhoIsThere != NOBODY && ubWhoIsThere != this->ubID )
{
SetUIBusy( this->ubID );
return;
}
else
{
if (this->bTeam == gbPlayerNum)
{
SetUIBusy( this->ubID );
}
this->sTempNewGridNo = NewGridNo( this->sGridNo, (UINT16)DirectionInc(bNewDirection ) );
this->sTempNewGridNo = NewGridNo( this->sGridNo, (UINT16)DirectionInc(bNewDirection ) );
this->ubPendingDirection = bNewDirection;
this->EVENT_InitNewSoldierAnim( CLIMBUPROOF, 0 , FALSE );
this->InternalReceivingSoldierCancelServices( FALSE );
this->InternalGivingSoldierCancelServices( FALSE );
this->BeginSoldierFenceUp( );
}
this->ubPendingDirection = bNewDirection;
this->EVENT_InitNewSoldierAnim( JUMPUPWALL, 0 , FALSE );
this->InternalReceivingSoldierCancelServices( FALSE );
this->InternalGivingSoldierCancelServices( FALSE );
// this->BeginSoldierClimbWallUp( );
}
}
}
}
void SOLDIERTYPE::BeginSoldierFenceUp( void )
void SOLDIERTYPE::BeginSoldierClimbWallUp( void )
{
INT8 bNewDirection;
UINT8 ubWhoIsThere;
if ( FindLowerLevelFence( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel > 0 ) )
if ( FindLowerLevelWall( this, this->sGridNo, this->ubDirection, &bNewDirection ) && ( this->pathing.bLevel > 0 ) )
{
if ( EnoughPoints( this, GetAPsToClimbRoof( this, TRUE ), 0, TRUE ) )
if ( EnoughPoints( this, GetAPsToJumpWall( this, TRUE ), 0, TRUE ) )
{
//Kaiden: Helps if we look where we are going before we try to climb on top of someone
ubWhoIsThere = WhoIsThere2( NewGridNo( this->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 0 );
@@ -8573,10 +8647,12 @@ void SOLDIERTYPE::BeginSoldierFenceUp( void )
bNewDirection = gTwoCDirection[ bNewDirection ];
this->ubPendingDirection = bNewDirection;
this->EVENT_InitNewSoldierAnim( CLIMBDOWNROOF, 0 , FALSE );
this->EVENT_InitNewSoldierAnim( JUMPDOWNWALL, 0 , FALSE );
this->InternalReceivingSoldierCancelServices( FALSE );
this->InternalGivingSoldierCancelServices( FALSE );
this->InternalGivingSoldierCancelServices( FALSE );
this->BeginSoldierClimbWall( );
}
}
@@ -8585,7 +8661,6 @@ void SOLDIERTYPE::BeginSoldierFenceUp( void )
}
//------------------------------------------------------------------------------------------
UINT32 SleepDartSuccumbChance( SOLDIERTYPE * pSoldier )
{
UINT32 uiChance;
@@ -9884,7 +9959,7 @@ void SOLDIERTYPE::BeginSoldierClimbDownRoof( void )
bNewDirection = gTwoCDirection[ bNewDirection ];
this->ubPendingDirection = bNewDirection;
this->EVENT_InitNewSoldierAnim( CLIMBDOWNROOF, 0 , FALSE );
this->EVENT_InitNewSoldierAnim( JUMPDOWNWALL, 0 , FALSE );
this->InternalReceivingSoldierCancelServices( FALSE );
this->InternalGivingSoldierCancelServices( FALSE );
@@ -11290,6 +11365,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection )
if ( !fRefused )
{
/*
if ( CREATURE_OR_BLOODCAT( pTSoldier ) )
{
// nope!!
@@ -11297,6 +11373,8 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_REFUSE_FIRSTAID_FOR_CREATURE ] );
}
else if ( !pTSoldier->aiData.bNeutral && pTSoldier->stats.bLife >= OKLIFE && pTSoldier->bSide != this->bSide )
*/
if ( !pTSoldier->aiData.bNeutral && pTSoldier->stats.bLife >= OKLIFE && pTSoldier->bSide != this->bSide )
{
fRefused = TRUE;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_REFUSE_FIRSTAID ] );
@@ -11606,16 +11684,19 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
usLifeReturned = pVictim->iHealableInjury * (gSkillTraitValues.ubDOSurgeryHealPercentBase + gSkillTraitValues.ubDOSurgeryHealPercentOnTop * NUM_SKILL_TRAITS( this, DOCTOR_NT ))/100;
pVictim->iHealableInjury = 0;
//CHRISL: Why would we arbitrarily use all ubPtsLeft when a victim isn't bleeding? And why would the medical bag, which we have to use in order to
// do surgery, have any extra benefit? Plus, the medical back bonus can actually result in ubPtsLeft being HIGHER then it was before we healed the
// victim, which makes no sense.
// keep the rest of the points to bandaging if neccessary
if (pVictim->bBleeding > 0)
{
//if (pVictim->bBleeding > 0)
//{
ubPtsLeft = max(0, (ubPtsLeft - (usLifeReturned / 100)));
ubPtsLeft += (ubPtsLeft/2); // we use medical bag so add the bonus for that.
}
else
{
ubPtsLeft = 0;
}
// ubPtsLeft += (ubPtsLeft/2); // we use medical bag so add the bonus for that.
//}
//else
//{
// ubPtsLeft = 0;
//}
// We are finished !!!
this->fDoingSurgery = FALSE;
@@ -11709,9 +11790,9 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
pVictim->flags.fWarnedAboutBleeding = FALSE;
}
//CHRISL: If by some chance ubPtsLeft ends up being higher then uiActual, we'll end up with a huge value since uiActual is an unsigned variable.
// if there are any ptsLeft now, then we didn't actually get to use them
uiActual = max(0, (uiActual - ubPtsLeft));
uiActual = max(0, (INT32)(uiActual - ubPtsLeft));
// usedAPs equals (actionPts) * (%of possible points actually used)
uiUsedAPs = ( uiActual * uiAvailAPs ) / uiPossible;
@@ -12934,6 +13015,10 @@ void HandlePlacingRoofMarker( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fSet
return;
}
//CHRISL: If sGridNo is -1, which can be the case if there is a dead merc still listed as part of a unit, crashes will occur
if ( sGridNo == -1 )
return;
if ( pSoldier->bTeam != gbPlayerNum )
{
//return;
@@ -12950,6 +13035,11 @@ void HandlePlacingRoofMarker( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fSet
{
return;
}
if ( pSoldier->usAnimState == JUMPUPWALL && !fForce )
{
return;
}
if ( pRoofNode != NULL )
{
@@ -13622,6 +13712,9 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid
//lal
// ATE; Check for normal civs...
BOOLEAN apsDeducted = FALSE;
if ( GetCivType( pTSoldier ) != CIV_TYPE_NA )
{
//lal
@@ -13634,14 +13727,19 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid
{
// Deduct points from our guy....
DeductPoints( this, sAPCost, 0 );
apsDeducted = TRUE;
StartCivQuote( pTSoldier );
return( FALSE );
}
}
// WANNE: This fixes the bug, that APs for talking are not always deducted.
if (!apsDeducted)
{
DeductPoints( this, sAPCost, 0 );
apsDeducted = TRUE;
}
// Are we an EPC that is being escorted?
if ( pTSoldier->ubProfile != NO_PROFILE && pTSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC )
@@ -13981,7 +14079,7 @@ void InternalPlaySoldierFootstepSound( SOLDIERTYPE * pSoldier )
// Determine if we are on the floor
if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
if ( pSoldier->usAnimState == HOPFENCE )
if ( pSoldier->usAnimState == HOPFENCE || pSoldier->usAnimState == JUMPWINDOWS)
{
bVolume = HIGHVOLUME;
}
@@ -14264,6 +14362,11 @@ void SetSoldierPersonalLightLevel( SOLDIERTYPE *pSoldier )
return;
}
if(gpWorldLevelData[pSoldier->sGridNo].pMercHead == NULL)
{
return;
}
//THe light level for the soldier
gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubShadeLevel = 3;
gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubSumLights = 5;
@@ -14271,56 +14374,14 @@ void SetSoldierPersonalLightLevel( SOLDIERTYPE *pSoldier )
gpWorldLevelData[pSoldier->sGridNo].pMercHead->ubNaturalShadeLevel = 5;
}
//---legion by JAzz---------------------------------------
void BeginSoldierFence( SOLDIERTYPE *pSoldier )
{
INT8 bNewDirection;
UINT8 ubWhoIsThere;
if ( FindFenceDirection( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->pathing.bLevel == 0 ) )
{
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, FALSE ), 0, TRUE ) )
{
//Kaiden: Helps if we look where we are going before we try to climb on top of someone
ubWhoIsThere = WhoIsThere2( NewGridNo( pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 1 );
if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID )
{
return;
}
else
{
if (pSoldier->bTeam == gbPlayerNum)
{
SetUIBusy( pSoldier->ubID );
}
pSoldier->sTempNewGridNo = NewGridNo( pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) );
pSoldier->ubPendingDirection = bNewDirection;
pSoldier->EVENT_InitNewSoldierAnim( CLIMBUPROOF, 0 , FALSE );
pSoldier->InternalReceivingSoldierCancelServices( FALSE );
pSoldier->InternalGivingSoldierCancelServices( FALSE );
BeginSoldierFenceUp( pSoldier );
}
}
}
}
void BeginSoldierFenceUp( SOLDIERTYPE *pSoldier )
void BeginSoldierClimbWallUp( SOLDIERTYPE *pSoldier )
{
INT8 bNewDirection;
UINT8 ubWhoIsThere;
if ( FindLowerLevelFence( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->pathing.bLevel > 0 ) )
if ( FindLowerLevelWall( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->pathing.bLevel > 0 ) )
{
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) )
if ( EnoughPoints( pSoldier, GetAPsToJumpWall( pSoldier, TRUE ), 0, TRUE ) )
{
//Kaiden: Helps if we look where we are going before we try to climb on top of someone
ubWhoIsThere = WhoIsThere2( NewGridNo( pSoldier->sGridNo, (UINT16)DirectionInc(bNewDirection ) ), 0 );
@@ -14341,7 +14402,7 @@ void BeginSoldierFenceUp( SOLDIERTYPE *pSoldier )
bNewDirection = gTwoCDirection[ bNewDirection ];
pSoldier->ubPendingDirection = bNewDirection;
pSoldier->EVENT_InitNewSoldierAnim( CLIMBDOWNROOF, 0 , FALSE );
pSoldier->EVENT_InitNewSoldierAnim( JUMPDOWNWALL, 0 , FALSE );
pSoldier->InternalReceivingSoldierCancelServices( FALSE );
pSoldier->InternalGivingSoldierCancelServices( FALSE );