- Fix: new clothes are not damaged

- Fix: changing clothes in sight of enemies no longer auto-hides
- Fix: opponent refresh for captured soldiers should work now
- Fix: prisons must have been liberated once to be able to send prisoners there
- adjusted spy trait for new animations
- Fix: allied militia no longer uncovers player spies

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5751 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2012-12-29 03:13:12 +00:00
parent a107e80c39
commit 4eccdec2ee
5 changed files with 39 additions and 25 deletions
+10
View File
@@ -61,6 +61,7 @@
#include "drugs and alcohol.h"
#include "Food.h"
#include "opplist.h"
#endif
#ifdef JA2UB
@@ -9288,6 +9289,9 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj)
SET_PALETTEREP_ID( pSoldier->VestPal, Clothes[clothestype].vest );
pSoldier->bSoldierFlagMask |= SOLDIER_NEW_VEST;
// this vest is not damaged, so remove the damaged vest flag
pSoldier->bSoldierFlagMask &= ~SOLDIER_DAMAGED_VEST;
}
if ( newpants )
@@ -9308,6 +9312,9 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj)
SET_PALETTEREP_ID( pSoldier->PantsPal, Clothes[clothestype].pants );
pSoldier->bSoldierFlagMask |= SOLDIER_NEW_PANTS;
// these pants are not damaged, so remove the damaged pants flag
pSoldier->bSoldierFlagMask &= ~SOLDIER_DAMAGED_PANTS;
}
// Use palette from HVOBJECT, then use substitution for pants, etc
@@ -9349,6 +9356,9 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj)
pSoldier->bSoldierFlagMask |= SOLDIER_COVERT_CIV;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_DISGUISED_AS_CIVILIAN], pSoldier->name );
}
// reevaluate sight - otherwise we could hide by changing clothes in plain sight!
OtherTeamsLookForMan(pSoldier);
}
}
+5
View File
@@ -6646,9 +6646,14 @@ BOOLEAN GetPlayerControlledPrisonSectorId(UINT32& auSectorID)
{
for(INT16 sY = 1; sY < MAP_WORLD_X - 1; ++sY )
{
// only sectors where there are no ongoing battles or even enemy garrisons are valid for our cause
if ( !SectorOursAndPeaceful( sX, sY, 0 ) )
continue;
// only allow sectors which we have controlled at least once - otherwise prisoners might get sent to San Mona prison, even though the player never was there
if ( !SectorInfo[ (UINT8)SECTOR( sX, sY ) ].fSurfaceWasEverPlayerControlled )
continue;
// Is there a prison in this sector?
for (UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt)
{
+13 -16
View File
@@ -14964,7 +14964,12 @@ BOOLEAN SOLDIERTYPE::SeemsLegit( UINT8 ubObserverID )
this->usAnimState == PICK_LOCK ||
this->usAnimState == LOCKPICK_CROUCHED ||
this->usAnimState == STEAL_ITEM_CROUCHED ||
this->usAnimState == JUMPWINDOWS
this->usAnimState == JUMPWINDOWS ||
this->usAnimState == FOCUSED_PUNCH ||
this->usAnimState == FOCUSED_STAB ||
this->usAnimState == HTH_KICK ||
this->usAnimState == FOCUSED_HTH_KICK ||
this->usAnimState == LONG_JUMP
)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_ACTIVITIES], this->name );
@@ -15156,8 +15161,8 @@ BOOLEAN SOLDIERTYPE::RecognizeAsCombatant(UINT8 ubTargetID)
return TRUE;
#endif
// if neither of the 2 persons is covert, always return true
if ( ( (pSoldier->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER)) == 0 ) && ( (this->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER)) == 0 ) )
// not in covert mode: we recognize him
if ( (pSoldier->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER)) == 0 )
return TRUE;
// neutral characters just dont care
@@ -15165,19 +15170,12 @@ BOOLEAN SOLDIERTYPE::RecognizeAsCombatant(UINT8 ubTargetID)
return TRUE;
// check for for vehicles and creatures... weird things happen
if ( IsVehicle(pSoldier) || pSoldier->bTeam == CREATURE_TEAM || this->bTeam == CREATURE_TEAM )
if ( IsVehicle(pSoldier) || IsVehicle(this) || pSoldier->bTeam == CREATURE_TEAM || this->bTeam == CREATURE_TEAM )
return TRUE;
// checking someone from our team...
if ( this->bTeam == pSoldier->bTeam )
{
// not in covert mode: we recognize him
if ( (pSoldier->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER)) == 0 )
return TRUE;
else
// we don't because we accept that he is covert (to not blow his cover)
return FALSE;
}
// if from same team, do not uncover
if ( this->bTeam == pSoldier->bTeam || this->bSide == pSoldier->bSide )
return TRUE;
// hack: if this is attacking us at this very moment by punching, do not recognize him...
// this resolves the problem that we attack someone from behind and kill him instantly, but the game mechanic forces him to turn before
@@ -15237,7 +15235,7 @@ void SOLDIERTYPE::Strip()
// if already not covert, take off clothes
else if ( this->bSoldierFlagMask & (SOLDIER_NEW_VEST|SOLDIER_NEW_PANTS) )
{
// if having a new vest that is undamaged, take it off
// if we have undamaged clothes, spawn them, the graphci will be removed anyway
if ( (this->bSoldierFlagMask & SOLDIER_NEW_VEST) && !(this->bSoldierFlagMask & SOLDIER_DAMAGED_VEST) )
{
UINT16 vestitem = 0;
@@ -15251,7 +15249,6 @@ void SOLDIERTYPE::Strip()
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_NO_CLOTHES_ITEM] );
}
// if having new pants that are undamaged, take them off
if ( (this->bSoldierFlagMask & SOLDIER_NEW_PANTS) && !(this->bSoldierFlagMask & SOLDIER_DAMAGED_PANTS) )
{
UINT16 pantsitem = 0;
+3
View File
@@ -414,6 +414,9 @@ extern CLOTHES_STRUCT Clothes[CLOTHES_MAX];
// but they can't attack empty vehicles!!
#define CONSIDERED_NEUTRAL( me, them ) ( (them->aiData.bNeutral || them->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER|SOLDIER_POW)) && ( me->bTeam != CREATURE_TEAM || (them->flags.uiStatusFlags & SOLDIER_VEHICLE) ) )
// Flugente: this version still counts POWs as enemies. This allows correct refreshing of the enemy count whn taking prisoners and then moving away
#define CONSIDERED_NEUTRAL_NOT_POW( me, them ) ( (them->aiData.bNeutral || them->bSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER)) && ( me->bTeam != CREATURE_TEAM || (them->flags.uiStatusFlags & SOLDIER_VEHICLE) ) )
typedef struct
{
UINT8 ubKeyID;
+8 -9
View File
@@ -1773,7 +1773,7 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT
{
// if neither side is neutral AND
// if this soldier is an opponent (fights for different side)
if (pSoldier->bActive && pOpponent->bActive && !CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide) && pSoldier->RecognizeAsCombatant(pOpponent->ubID) )
if (pSoldier->bActive && pOpponent->bActive && !CONSIDERED_NEUTRAL_NOT_POW( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL_NOT_POW( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide) && pSoldier->RecognizeAsCombatant(pOpponent->ubID) )
{
RemoveOneOpponent(pSoldier);
}
@@ -6807,7 +6807,7 @@ void DecayIndividualOpplist(SOLDIERTYPE *pSoldier)
if (pSoldier->stats.bLife < OKLIFE)
{
// must make sure that public opplist is kept to match...
for ( uiLoop = 0; uiLoop < TOTAL_SOLDIERS; uiLoop++ )
for ( uiLoop = 0; uiLoop < TOTAL_SOLDIERS; ++uiLoop )
{
if ( pSoldier->aiData.bOppList[ uiLoop ] == SEEN_CURRENTLY )
{
@@ -6822,7 +6822,7 @@ void DecayIndividualOpplist(SOLDIERTYPE *pSoldier)
}
// man looks for each of his opponents WHO IS CURRENTLY SEEN
for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++)
for (uiLoop = 0; uiLoop < guiNumMercSlots; ++uiLoop)
{
pOpponent = MercSlots[ uiLoop ];
@@ -6835,21 +6835,20 @@ void DecayIndividualOpplist(SOLDIERTYPE *pSoldier)
continue;
}
pPersOL = pSoldier->aiData.bOppList + pOpponent->ubID;
pPersOL = pSoldier->aiData.bOppList + pOpponent->ubID;
// if this opponent is seen currently
if (*pPersOL == SEEN_CURRENTLY)
{
// if this opponent is seen currently
if (*pPersOL == SEEN_CURRENTLY)
{
// they are NOT visible now!
(*pPersOL)++;
if (!CONSIDERED_NEUTRAL( pOpponent, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, pOpponent ) && (pSoldier->bSide != pOpponent->bSide) && pSoldier->RecognizeAsCombatant(pOpponent->ubID) )
{
RemoveOneOpponent(pSoldier);
}
}
}
}
}
}