Merged revision(s) 7166-7177 from branches/ja2_source_official_2014:

- Flagmasks are unsigned, and should be called and treated as such
- Fix: experience gain from interrogation was too high
- Fix: chance of a prisoner becoming militia was calculated wrong
- default weight maximum for MOVE ITEM assignment increased from 30 to 40 kg
- Fix: snitches report the same event multiple times
- Fix: snitches treat vehicles as persons
- Fix: selection of launchables is inefficient, an does not take into account wether items are depending on day/night cycle
- new key combination: in strategic, pressing [CTRL] + [E] wile both a merc's inventory and the sector inventory are open will fill the merc's inventory with sector items
- trivial code cleanup
- if prisoners are taken in a sector that houses a prison, that prison can also be selected to house them
- Fix: distributing newly taken prisoners in a prison sector no longer redistributes all prisoners, only the new ones
- GetClosestFlaggedSoldierID can also be called without evaluation of sight
- Fix: Covert Ops: throwing/lobbing items or shooting rockets is deemed suspicious behaviour
- Fix: boxing was broken by loading a savegame
- Fix: campaign history rarely recorded kills in autoresolve
- There is no reason why the IDs that boxers are reset to before they are reinitialised would ever need to be altered by a modder. Required script change in stable GameDir r2024.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7178 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-04-30 21:36:18 +00:00
parent 8b494003fd
commit 30060f0595
46 changed files with 759 additions and 711 deletions
+2 -2
View File
@@ -1317,7 +1317,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier)
// pSoldier->flags.fNoAPToFinishMove = FALSE;
// Flugente: pows don't do anything
if ( pSoldier->bSoldierFlagMask & SOLDIER_POW )
if ( pSoldier->usSoldierFlagMask & SOLDIER_POW )
{
EndAIGuysTurn( pSoldier);
return;
@@ -2054,7 +2054,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
{
HandleInitialRedAlert(pSoldier->bTeam, TRUE);
pSoldier->bSoldierFlagMask |= SOLDIER_RAISED_REDALERT;
pSoldier->usSoldierFlagMask |= SOLDIER_RAISED_REDALERT;
}
// SANDRO - ENEMY TAUNTS
+4 -4
View File
@@ -1529,7 +1529,7 @@ INT32 ClosestUnDisguisedPC( SOLDIERTYPE *pSoldier, INT32 * psDistance )
if ( AM_AN_EPC( pTargetSoldier ) )
continue;
if ( pTargetSoldier->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
if ( pTargetSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
continue;
sDist = PythSpacesAway(pSoldier->sGridNo,pTargetSoldier->sGridNo);
@@ -3070,7 +3070,7 @@ INT32 CalcStraightThreatValue( SOLDIERTYPE *pEnemy )
}
// Flugente: get the id of the closest soldier with a specific flag that we can currently see
UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag )
UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight )
{
UINT8 id = NOBODY;
UINT32 uiLoop;
@@ -3103,7 +3103,7 @@ UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au
continue;
// check for flag
if ( !(pFriend->bSoldierFlagMask & aFlag) )
if ( !(pFriend->usSoldierFlagMask & aFlag) )
continue;
// are we close enough?
@@ -3111,7 +3111,7 @@ UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au
if ( friendrange < range)
{
// can we see this guy?
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pFriend->sGridNo, pSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) )
if ( !fCheckSight || SoldierTo3DLocationLineOfSightTest( pSoldier, pFriend->sGridNo, pSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) )
{
range = friendrange;
id = pFriend->ubID;
+1 -1
View File
@@ -3243,7 +3243,7 @@ BOOLEAN GetBestAoEGridNo(SOLDIERTYPE *pSoldier, INT32* pGridNo, INT16 aRadius, U
continue;
// dying or captured friends are 'helpless' anyway, we are willing to sacrifice them :-)
if ( uCheckFriends && pSoldier->bSide == pFriend->bSide && pFriend->stats.bLife > OKLIFE && !(pFriend->bSoldierFlagMask & SOLDIER_POW) )
if ( uCheckFriends && pSoldier->bSide == pFriend->bSide && pFriend->stats.bLife > OKLIFE && !(pFriend->usSoldierFlagMask & SOLDIER_POW) )
{
// active friend, remember where he is so that we DON'T blow him up!
// this includes US, since we don't want to blow OURSELVES up either
+12 -13
View File
@@ -732,7 +732,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
{
if (usRoom == BOXING_RING)
{
for ( ubLoop = 0; ubLoop < NUM_BOXERS; ubLoop++ )
for ( ubLoop = 0; ubLoop < NUM_BOXERS; ++ubLoop )
{
if (pSoldier->ubID == gubBoxerID[ ubLoop ])
{
@@ -757,8 +757,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
if (pTeamSoldier->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL)
pTeamSoldier->flags.uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL);
if (pTeamSoldier->flags.uiStatusFlags & SOLDIER_BOXER)
pTeamSoldier->flags.uiStatusFlags &= (~SOLDIER_BOXER);
pTeamSoldier->DeleteBoxingFlag( );
}
if (pSoldier->bTeam == gbPlayerNum || CountPeopleInBoxingRing() == 0)
@@ -885,7 +884,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
}
//ddd{
if( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && gGameExternalOptions.bNewTacticalAIBehavior && pSoldier->bTeam == ENEMY_TEAM )
if( !(pSoldier->usSoldierFlagMask & SOLDIER_RAISED_REDALERT) && gGameExternalOptions.bNewTacticalAIBehavior && pSoldier->bTeam == ENEMY_TEAM )
{
if ( !(gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
{
@@ -922,7 +921,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
// Flugente: if we see one of our buddies in handcuffs, its a clear sign of enemy activity!
if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM && !gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition )
{
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW );
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE );
if ( ubPerson != NOBODY )
{
@@ -1604,7 +1603,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
// Flugente: if we see one of our buddies captured, it is a clear sign of enemy activity!
if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM )
{
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW );
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE );
if ( ubPerson != NOBODY )
{
@@ -1637,7 +1636,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
}
}
}
else if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && !gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition )
else if ( !(pSoldier->usSoldierFlagMask & SOLDIER_RAISED_REDALERT) && !gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition )
{
// raise alarm!
return( AI_ACTION_RED_ALERT );
@@ -2778,7 +2777,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
}
}
// frequencies are clear, lets call for help
else if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) )
else if ( !(pSoldier->usSoldierFlagMask & SOLDIER_RAISED_REDALERT) )
{
// raise alarm!
return( AI_ACTION_RED_ALERT );
@@ -2964,7 +2963,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
// Flugente: if we see one of our buddies captured, it is a clear sign of enemy activity!
if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM )
{
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW );
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE );
if ( ubPerson != NOBODY )
{
@@ -3169,7 +3168,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
// if we're a computer merc, and we have the action points remaining to RADIO
// (we never want NPCs to choose to radio if they would have to wait a turn)
if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && !fCivilian && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
if ( !(pSoldier->usSoldierFlagMask & SOLDIER_RAISED_REDALERT) && !fCivilian && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: checking to radio red alert");
@@ -4665,7 +4664,7 @@ INT16 ubMinAPCost;
}
}
// frequencies are clear, lets call for help
else if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) )
else if ( !(pSoldier->usSoldierFlagMask & SOLDIER_RAISED_REDALERT) )
{
// raise alarm!
return( AI_ACTION_RED_ALERT );
@@ -6048,7 +6047,7 @@ L_NEWAIM:
// (we never want NPCs to choose to radio if they would have to wait a turn)
// and we're not swimming in deep water, and somebody has called for spotters
// and we see the location of at least 2 opponents
if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && (gTacticalStatus.ubSpottersCalledForBy != NOBODY) && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) &&
if ( !(pSoldier->usSoldierFlagMask & SOLDIER_RAISED_REDALERT) && (gTacticalStatus.ubSpottersCalledForBy != NOBODY) && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) &&
(pSoldier->aiData.bOppCnt > 1) && !fCivilian &&
(gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) && !bInDeepWater)
{
@@ -6187,7 +6186,7 @@ L_NEWAIM:
// RADIO RED ALERT: determine %chance to call others and report contact
////////////////////////////////////////////////////////////////////////////
if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && pSoldier->bTeam == MILITIA_TEAM && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
if ( !(pSoldier->usSoldierFlagMask & SOLDIER_RAISED_REDALERT) && pSoldier->bTeam == MILITIA_TEAM && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
{
// if there hasn't been an initial RED ALERT yet in this sector
+1 -1
View File
@@ -190,7 +190,7 @@ INT32 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN
continue; // next merc
// Flugente: chance to ignore the noise if the ceator is covert
if ( pTemp->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
if ( pTemp->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
{
// green AI state: always ignore
// yellow AI state: 50% chance to ignore
+1 -1
View File
@@ -73,7 +73,7 @@ void RTHandleAI( SOLDIERTYPE * pSoldier )
}
// Flugente: prisoners of war don't do anything
if ( pSoldier->bSoldierFlagMask & SOLDIER_POW )
if ( pSoldier->usSoldierFlagMask & SOLDIER_POW )
return;
// if man has nothing to do
+1 -1
View File
@@ -262,7 +262,7 @@ INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sO
UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo );
// Flugente: get the id of the closest soldier (coser than x tiles) of a specific team with a specific flag that we can currently see
UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag );
UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight = TRUE );
// get the id of the closest soldier (closer than x tiles) of a specific team that is wounded that we can currently see
UINT8 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam );