- Fixed problems with merc faces when doing certain actions. This bug was introduced in revision: 4396

o Fixes endless loop when clicking on items with explosives and merc starts to talk
o Fixes hidden merc faces
o Fixes wrong merc faces (merc face instead of skull) when merc is dead

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4456 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-05-29 16:08:27 +00:00
parent 993f3a204c
commit 2b7f79db94
5 changed files with 69 additions and 11 deletions
+7 -3
View File
@@ -5001,9 +5001,13 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
{
if(MercPtrs[cnt]->ubID == cnt)
{
SetCamoFace( MercPtrs[cnt] );
DeleteSoldierFace( MercPtrs[cnt] );// remove face
MercPtrs[cnt]->iFaceIndex = InitSoldierFace( MercPtrs[cnt] );// create new face
// WANNE: We should only delete the face, if there was a camo we applied.
// This should fix the bug and crashes with missing faces
if (SetCamoFace( MercPtrs[cnt] ))
{
DeleteSoldierFace( MercPtrs[cnt] );// remove face
MercPtrs[cnt]->iFaceIndex = InitSoldierFace( MercPtrs[cnt] );// create new face
}
}
}
+15 -1
View File
@@ -724,7 +724,8 @@ void SetAutoFaceInActive(INT32 iFaceIndex )
pFace->fDisabled = TRUE;
}
void SetCamoFace(SOLDIERTYPE * pSoldier)
BOOLEAN SetCamoFace(SOLDIERTYPE * pSoldier)
{
INT8 worn = -1;
INT8 applied = -1;
@@ -754,8 +755,13 @@ void SetCamoFace(SOLDIERTYPE * pSoldier)
applied = loop;
}
BOOLEAN isCamoFace = FALSE;
if(applied != -1 && worn != -1)
{
isCamoFace = TRUE;
if(appliedCamo[applied] >= wornCamo[worn])
{
if(applied == 0)
@@ -766,9 +772,13 @@ void SetCamoFace(SOLDIERTYPE * pSoldier)
gCamoFace[pSoldier->ubProfile].gDesertCamoface = TRUE;
if(applied == 3)
gCamoFace[pSoldier->ubProfile].gSnowCamoface = TRUE;
return TRUE;
}
else
{
isCamoFace = TRUE;
if(worn == 0)
gCamoFace[pSoldier->ubProfile].gCamoface = TRUE;
if(worn == 1)
@@ -781,6 +791,8 @@ void SetCamoFace(SOLDIERTYPE * pSoldier)
}
else if(applied != -1 || worn != -1)
{
isCamoFace = TRUE;
if(applied == 0 || worn == 0)
gCamoFace[pSoldier->ubProfile].gCamoface = TRUE;
if(applied == 1 || worn == 1)
@@ -790,6 +802,8 @@ void SetCamoFace(SOLDIERTYPE * pSoldier)
if(applied == 3 || worn == 3)
gCamoFace[pSoldier->ubProfile].gSnowCamoface = TRUE;
}
return isCamoFace;
}
void SetAllAutoFacesInactive( )
+39 -3
View File
@@ -3166,12 +3166,48 @@ void SMInvClickCamoCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
if ( fGoodAPs )
{
// WANNE: Old method for applying camo
/*
if (gGameExternalOptions.fShowCamouflageFaces == TRUE )
{
SetCamoFace( gpSMCurrentMerc );
DeleteSoldierFace( gpSMCurrentMerc );// remove face
gpSMCurrentMerc->iFaceIndex = InitSoldierFace( gpSMCurrentMerc );// create new face
if ( gpSMCurrentMerc->bCamo > 0 )
{
gCamoFace[gpSMCurrentMerc->ubProfile].gCamoface = TRUE;
DeleteSoldierFace( gpSMCurrentMerc );// remove face
gpSMCurrentMerc->iFaceIndex = InitSoldierFace( gpSMCurrentMerc );// create new face
}
if ( gpSMCurrentMerc->urbanCamo > 0 )
{
gCamoFace[gpSMCurrentMerc->ubProfile].gUrbanCamoface = TRUE;
DeleteSoldierFace( gpSMCurrentMerc );// remove face
gpSMCurrentMerc->iFaceIndex = InitSoldierFace( gpSMCurrentMerc );// create new face
}
if ( gpSMCurrentMerc->desertCamo > 0)
{
gCamoFace[gpSMCurrentMerc->ubProfile].gDesertCamoface = TRUE;
DeleteSoldierFace( gpSMCurrentMerc );// remove face
gpSMCurrentMerc->iFaceIndex = InitSoldierFace( gpSMCurrentMerc );// create new face
}
if ( gpSMCurrentMerc->snowCamo > 0)
{
gCamoFace[gpSMCurrentMerc->ubProfile].gSnowCamoface = TRUE;
DeleteSoldierFace( gpSMCurrentMerc );// remove face
gpSMCurrentMerc->iFaceIndex = InitSoldierFace( gpSMCurrentMerc );// create new face
}
}
*/
// WANNE: We should only delete the face, if there was a camo we applied.
// This should fix the bug and crashes with missing faces
if (gGameExternalOptions.fShowCamouflageFaces == TRUE )
{
if (SetCamoFace( gpSMCurrentMerc ))
{
DeleteSoldierFace( gpSMCurrentMerc );// remove face
gpSMCurrentMerc->iFaceIndex = InitSoldierFace( gpSMCurrentMerc );// create new face
}
}
// Dirty
fInterfacePanelDirty = DIRTYLEVEL2;
+7 -3
View File
@@ -10990,9 +10990,13 @@ void ApplyEquipmentBonuses(SOLDIERTYPE * pSoldier)
//if ( pSoldier->bInSector)
// pSoldier->CreateSoldierPalettes( );
SetCamoFace( pSoldier );
DeleteSoldierFace( pSoldier );// remove face
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );// create new face
// WANNE: We should only delete the face, if there was a camo we applied.
// This should fix the bug and crashes with missing faces
if (SetCamoFace( pSoldier ))
{
DeleteSoldierFace( pSoldier );// remove face
pSoldier->iFaceIndex = InitSoldierFace( pSoldier );// create new face
}
fInterfacePanelDirty = DIRTYLEVEL2;
}
+1 -1
View File
@@ -252,7 +252,7 @@ void InternalShutupaYoFace( INT32 iFaceIndex, BOOLEAN fForce );
// If you still want the face in moemory but want to stop if from being displayed, or handled call
void SetAutoFaceInActive( INT32 iFaceIndex );
void SetCamoFace(SOLDIERTYPE * pSoldier);
BOOLEAN SetCamoFace(SOLDIERTYPE * pSoldier);
// To set all currently allocated faces to either active or incactive, call these
void SetAllAutoFacesInactive( );