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

* Merged Source Code from Development Trunk: Revision 4063 *
************************************************************
- Source Code is merged from: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
- This will be the Source for the Beta 2011 Test

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4064 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-01-18 09:11:09 +00:00
parent 44e1646410
commit 91087ca8c0
469 changed files with 118108 additions and 24678 deletions
+144 -33
View File
@@ -8,7 +8,7 @@
#include "debug.h"
#include "MemMan.h"
#include "Overhead Types.h"
//#include "Soldier Control.h"
#include "Soldier Control.h" // I need this here - SANDRO
#include "Animation Cache.h"
#include "Animation Data.h"
#include "Animation Control.h"
@@ -265,7 +265,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
{
INT16 sXPos, sYPos;
//sNewGridNo = NewGridNo( (INT16)pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->ubDirection ) );
//sNewGridNo = NewGridNo( pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->ubDirection ) );
ConvertMapPosToWorldTileCenter( pSoldier->sTempNewGridNo, &sXPos, &sYPos );
pSoldier->EVENT_SetSoldierPosition( (FLOAT)sXPos, (FLOAT)sYPos );
}
@@ -887,8 +887,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
//CODE: BEGINHOPFENCE
// MOVE TWO FACGIN GRIDNOS
sNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) );
sNewGridNo = NewGridNo( sNewGridNo, DirectionInc( pSoldier->ubDirection ) );
sNewGridNo = NewGridNo( pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
//dddokno{
if ( gubWorldMovementCosts[ sNewGridNo ][ (UINT8)pSoldier->pathing.usPathingData[ pSoldier->pathing.usPathIndex ] ][ pSoldier->pathing.bLevel ] == TRAVELCOST_FENCE )
sNewGridNo = NewGridNo( sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
//dddokno}
//comm by ddd
//sNewGridNo = NewGridNo( sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
pSoldier->sForcastGridno = sNewGridNo;
break;
@@ -1181,11 +1187,22 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
{
BOOLEAN fMartialArtist = FALSE;
if ( pSoldier->ubProfile != NO_PROFILE )
if ( pSoldier->ubProfile != NO_PROFILE && pSoldier->ubBodyType == REGMALE ) // SANDRO - added check for body type
{
if ( gMercProfiles[ pSoldier->ubProfile ].bSkillTrait == MARTIALARTS || gMercProfiles[ pSoldier->ubProfile ].bSkillTrait2 == MARTIALARTS )
// SANDRO - old/new traits
if (gGameOptions.fNewTraitSystem)
{
fMartialArtist = TRUE;
if ( NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ) >= ((gSkillTraitValues.fPermitExtraAnimationsOnlyToMA) ? 2 : 1 ) )
{
fMartialArtist = TRUE;
}
}
else
{
if ( ProfileHasSkillTrait( pSoldier->ubProfile, MARTIALARTS_OT ) > 0 )
{
fMartialArtist = TRUE;
}
}
}
@@ -1525,7 +1542,11 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
// CODE: GIVE ITEM
SoldierGiveItemFromAnimation( pSoldier );
if (pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile >= FIRST_NPC )
// if (pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile >= FIRST_NPC )
//new profiles by Jazz
if (pSoldier->ubProfile != NO_PROFILE && (gProfilesNPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile ||
gProfilesRPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile ||
gProfilesVehicle[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile))
{
TriggerNPCWithGivenApproach( pSoldier->ubProfile, APPROACH_DONE_GIVING_ITEM, FALSE );
}
@@ -1760,6 +1781,27 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
// PLAY SOLDIER'S DODGE ANIMATION
pTSoldier->ChangeSoldierState( DODGE_ONE, 0 , FALSE );
// SANDRO - after dodging melee attack go to apropriate stance
if ( (gAnimControl[ pTSoldier->usAnimState ].ubHeight == ANIM_STAND) && (Item[pTSoldier->inv[HANDPOS].usItem].usItemClass == IC_PUNCH))
{
if ((((NUM_SKILL_TRAITS( pTSoldier, MARTIAL_ARTS_NT ) >= ((gSkillTraitValues.fPermitExtraAnimationsOnlyToMA) ? 2 : 1 )) && gGameOptions.fNewTraitSystem ) ||
(HAS_SKILL_TRAIT( pTSoldier, MARTIALARTS_OT ) && !gGameOptions.fNewTraitSystem ) ) &&
pTSoldier->ubBodyType == REGMALE )
{
//pTSoldier->usPendingAnimation = NINJA_GOTOBREATH;
pTSoldier->usPendingAnimation = NINJA_BREATH ;
}
else
{
pTSoldier->usPendingAnimation = PUNCH_BREATH ;
}
}
else if ( (gAnimControl[ pTSoldier->usAnimState ].ubHeight == ANIM_STAND) && (Item[pTSoldier->inv[HANDPOS].usItem].usItemClass == IC_BLADE))
{
//pTSoldier->usPendingAnimation = KNIFE_GOTOBREATH;
pTSoldier->usPendingAnimation = KNIFE_BREATH ;
}
}
}
}
@@ -2918,7 +2960,7 @@ BOOLEAN ShouldMercSayHappyWithGunQuote( SOLDIERTYPE *pSoldier )
{
// How do we do this....
if ( QuoteExp_GotGunOrUsedGun[ pSoldier->ubProfile ] == QUOTE_SATISFACTION_WITH_GUN_AFTER_KILL )
if ( QuoteExp[ pSoldier->ubProfile ].QuoteExpGotGunOrUsedGun == QUOTE_SATISFACTION_WITH_GUN_AFTER_KILL )
{
// For one, only once a day...
if ( pSoldier->usQuoteSaidFlags & SOLDIER_QUOTE_SAID_LIKESGUN )
@@ -3071,7 +3113,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier
// Are we killing mike?
if ( pKilledSoldier->ubProfile == 149 && pKillerSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC )
if ( pKilledSoldier->ubProfile == MIKE && pKillerSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC )
{
// Can we see?
if ( fCanWeSeeLocation )
@@ -3080,7 +3122,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier
}
}
// Are we killing factory mamager?
else if ( pKilledSoldier->ubProfile == 139 )
else if ( pKilledSoldier->ubProfile == DOREEN )
{
// Can we see?
//f ( fCanWeSeeLocation )
@@ -3281,10 +3323,35 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse )
}
else
{
UINT8 ubAssister;
//////////////////////////////////////////////////////////////
// SANDRO - some changes here
UINT8 ubAttacker = pSoldier->ubAttackerID;
UINT8 ubAssister = pSoldier->ubPreviousAttackerID;
// If attacker is nobody, and we died, then set the last attacker(if exists) as our killer
if ( ubAttacker == NOBODY )
{
if ( ubAssister != NOBODY )
{
ubAttacker = pSoldier->ubPreviousAttackerID;
ubAssister = pSoldier->ubNextToPreviousAttackerID;
}
else if ( pSoldier->ubNextToPreviousAttackerID != NOBODY )
{
ubAttacker = pSoldier->ubNextToPreviousAttackerID;
ubAssister = NOBODY;
}
}
else
{
if ( ubAssister == NOBODY )
{
ubAssister = pSoldier->ubNextToPreviousAttackerID;
}
}
//////////////////////////////////////////////////////////////
// IF this guy has an attacker and he's a good guy, play sound
if ( pSoldier->ubAttackerID != NOBODY )
if ( ubAttacker != NOBODY )
{
if ( MercPtrs[ pSoldier->ubAttackerID ]->bTeam == gbPlayerNum && gTacticalStatus.ubAttackBusyCount > 0 )
{
@@ -3292,7 +3359,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse )
gTacticalStatus.ubEnemyKilledOnAttack = pSoldier->ubID;
gTacticalStatus.ubEnemyKilledOnAttackLocation = pSoldier->sGridNo;
gTacticalStatus.bEnemyKilledOnAttackLevel = pSoldier->pathing.bLevel;
gTacticalStatus.ubEnemyKilledOnAttackKiller = pSoldier->ubAttackerID;
gTacticalStatus.ubEnemyKilledOnAttackKiller = ubAttacker;
// also check if we are in mapscreen, if so update soldier's list
if( guiCurrentScreen == MAP_SCREEN )
@@ -3303,9 +3370,9 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse )
else if ( pSoldier->bVisible == TRUE )
{
// We were a visible enemy, say laugh!
if ( Random(3) == 0 && !CREATURE_OR_BLOODCAT( MercPtrs[ pSoldier->ubAttackerID ] ) )
if ( Random(3) == 0 && !CREATURE_OR_BLOODCAT( MercPtrs[ ubAttacker ] ) )
{
MercPtrs[ pSoldier->ubAttackerID ]->DoMercBattleSound( BATTLE_SOUND_LAUGH1 );
MercPtrs[ ubAttacker ]->DoMercBattleSound( BATTLE_SOUND_LAUGH1 );
}
}
}
@@ -3315,37 +3382,72 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse )
// if a friendly with a profile, increment kills
// militia also now track kills...
if ( pSoldier->ubAttackerID != NOBODY )
if ( ubAttacker != NOBODY )
{
if ( MercPtrs[ pSoldier->ubAttackerID ]->bTeam == gbPlayerNum )
if ( MercPtrs[ ubAttacker ]->bTeam == gbPlayerNum )
{
// increment kills
gMercProfiles[ MercPtrs[ pSoldier->ubAttackerID ]->ubProfile ].usKills++;
/////////////////////////////////////////////////////////////////////////////////////
// SANDRO - experimental - more specific statistics of mercs
switch(pSoldier->ubSoldierClass)
{
case SOLDIER_CLASS_ELITE :
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsElites++;
break;
case SOLDIER_CLASS_ARMY :
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsRegulars++;
break;
case SOLDIER_CLASS_ADMINISTRATOR :
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsAdmins++;
break;
case SOLDIER_CLASS_CREATURE :
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsCreatures++;
break;
default :
if ( CREATURE_OR_BLOODCAT( pSoldier ) )
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsCreatures++;
else if ( TANK( pSoldier ) )
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsTanks++;
else if ( pSoldier->bTeam == CIV_TEAM && !pSoldier->aiData.bNeutral && pSoldier->bSide != gbPlayerNum )
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsHostiles++;
else
gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsOthers++;
break;
}
//gMercProfiles[ MercPtrs[ pSoldier->ubAttackerID ]->ubProfile ].usKills++;
/////////////////////////////////////////////////////////////////////////////////////
gStrategicStatus.usPlayerKills++;
}
else if ( MercPtrs[ pSoldier->ubAttackerID ]->bTeam == MILITIA_TEAM )
else if ( MercPtrs[ ubAttacker ]->bTeam == MILITIA_TEAM )
{
// get a kill! 2 points!
MercPtrs[ pSoldier->ubAttackerID ]->ubMilitiaKills += 2;
MercPtrs[ ubAttacker ]->ubMilitiaKills += 2;
}
}
// JA2 Gold: if previous and current attackers are the same, the next-to-previous attacker gets the assist
if (pSoldier->ubPreviousAttackerID == pSoldier->ubAttackerID)
{
ubAssister = pSoldier->ubNextToPreviousAttackerID;
}
else
{
ubAssister = pSoldier->ubPreviousAttackerID;
}
if ( ubAssister != NOBODY && ubAssister != pSoldier->ubAttackerID )
if ( ubAssister != NOBODY && ubAssister != ubAttacker )
{
if ( MercPtrs[ ubAssister ]->bTeam == gbPlayerNum )
{
gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].usAssists++;
/////////////////////////////////////////////////////////////////////////////////////
// SANDRO - new mercs' records
if( MercPtrs[ ubAttacker ] != NULL )
{
if( MercPtrs[ ubAttacker ]->bTeam == gbPlayerNum )
gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsMercs++;
else if ( MercPtrs[ ubAttacker ]->bTeam == MILITIA_TEAM )
gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsMilitia++;
else
gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsOthers++;
}
else
{
gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsOthers++;
}
//gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].usAssists++;
/////////////////////////////////////////////////////////////////////////////////////
}
else if ( MercPtrs[ ubAssister ]->bTeam == MILITIA_TEAM )
{
@@ -3561,6 +3663,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier )
INT8 bTestDirection = pSoldier->ubDirection;
BOOLEAN fForceDirection = FALSE;
BOOLEAN fDoFallback = FALSE;
BOOLEAN fAlwaysFallBack = FALSE; // added by SANDRO
// Lesh: lets fix dead humans fallback through obstacles
@@ -3571,7 +3674,15 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier )
#elif defined ( TESTFALLFORWARD )
if ( 0 )
#else
if ( Random(100 ) > 40 && IS_MERC_BODY_TYPE( pSoldier ) && !IsProfileATerrorist( pSoldier->ubProfile ) )
// SANDRO - if Martial Artist took someone down, always fall back if possible (for the fun)
if ( pSoldier->ubAttackerID != NOBODY && gGameOptions.fNewTraitSystem )
{
if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || Item[MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem].brassknuckles ) )
{
fAlwaysFallBack = TRUE;
}
}
if ( (Random(100 ) > 40 || fAlwaysFallBack) && IS_MERC_BODY_TYPE( pSoldier ) && !IsProfileATerrorist( pSoldier->ubProfile ) )
#endif
{
// CHECK IF WE HAVE AN ATTACKER, TAKE OPPOSITE DIRECTION!