mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Store the profile type in the profile structure and remove superfluous code
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8620 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -120,7 +120,7 @@ DDBox::Display( )
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
|
||||
// IMP faces are stored elsewhere
|
||||
if ( gProfilesIMP[mEvent.usSpeaker].ProfilId == mEvent.usSpeaker )
|
||||
if ( gMercProfiles[mEvent.usSpeaker].Type == PROFILETYPE_IMP )
|
||||
{
|
||||
sprintf( sTemp, "IMPFACES\\%02d.sti", gMercProfiles[mEvent.usSpeaker].ubFaceIndex );
|
||||
}
|
||||
|
||||
@@ -361,16 +361,10 @@ INT16 GetNextPreviousCharacter( INT16 curChar, BOOLEAN next, ENC_DATA_FILTER_CHA
|
||||
*|1b. Menptr[ NUM_PROFILES ] |SOLDIERTYPE, huge struct | YES | On tactical those are the people / vehicles / monsters / EPCs. Can provide a reference to a profile. Most likely they are destroyed upon unloading the map, to be recreated with potentially different profiles. Therfore not usable here.
|
||||
*|2a. AimMercArray[ NUM_PROFILES ] |UINT8, IDs for gMercProfiles | YES | Used for AIM website. Aim members are on beginning of array, empty spots have (UNIT8)-1.
|
||||
*|2b. gAimAvailability[ NUM_PROFILES ] |AIM_AVAILABLE, stuct | YES | Used for AIM website to get bio text and profile ID.
|
||||
*|2c. gProfilesAIM[ NUM_PROFILES ] |AIM_PROFIL, IDs for gMercProfiles | YES | In contrast to 2b Index of gMercProfiles == Index of gProfilesAIM and gProfilesAIM[i].profileId == i when it is an AIM member, otherwise gProfilesAIM[i].profileId == (UINT8)-1.
|
||||
*|3a. gubMercArray[ NUM_PROFILES ] |UINT8, IDs for gMercProfiles | YES | Used for MERC website. MERC mebers are on beginning of array, empty spots have (UNIT8)-1.
|
||||
*|3b. gConditionsForMercAvailability[ NUM_PROFILES ] |CONTITION_FOR_MERC_AVAILABLE, struct | YES | Used for MERC website to get bio text, profile ID and other data. MERC mebers are on beginning of array, empty spots have ProfilId = 0.
|
||||
*|3c. gProfilesMERC[ NUM_PROFILES ] |MERC_PROFIL see 2c | YES | see 2c.
|
||||
*|4. gProfilesNPC[ NUM_PROFILES ] |NPC_PROFIL see 2c | YES | see 2c.
|
||||
*|5. gProfilesRPC[ NUM_PROFILES ] |RPC_PROFIL see 2c | YES | see 2c.
|
||||
*|6a. pVehicleList(variable Size) |VEHICLETYPE, medium struct | YES | Same principle as 1b, but data valid regardless of game state.
|
||||
*|6b. gNewVehicle[ NUM_PROFILES ] |NEW_CAR, medium struct | NO | Used to get vehicle 'face', Snds, name ec. Index is identical to gMercProfiles.
|
||||
*|6c. gProfilesVehicle[ NUM_PROFILES ] |VEHICLE_PROFIL see 2c | NO | see 2c. Potentially more then one vehicle of a type can be created, but this is irrelevant as we are showing only the different types anyway.
|
||||
*|7. gProfilesIMP[ NUM_PROFILES ] |IMP_PROFILE see 2c | YES | see 2c.
|
||||
*/
|
||||
notFound = FALSE;
|
||||
switch(filterClass)
|
||||
@@ -379,8 +373,8 @@ INT16 GetNextPreviousCharacter( INT16 curChar, BOOLEAN next, ENC_DATA_FILTER_CHA
|
||||
// no filter, found char
|
||||
return i;
|
||||
case ENC_DATA_FILTER_C_AIM : // hireable characters from A.I.M.
|
||||
if( gProfilesAIM[i].ProfilId != (UINT8)-1 )
|
||||
return gProfilesAIM[i].ProfilId;
|
||||
if ( gMercProfiles[i].Type == PROFILETYPE_AIM )
|
||||
return i;
|
||||
//if( gAimAvailability[ i ].ProfilId != (UINT8)-1 )
|
||||
// return gAimAvailability[ i ].ProfilId;
|
||||
notFound = TRUE;//no AIM
|
||||
@@ -388,15 +382,15 @@ INT16 GetNextPreviousCharacter( INT16 curChar, BOOLEAN next, ENC_DATA_FILTER_CHA
|
||||
case ENC_DATA_FILTER_C_MERC : // hireable characters from M.E.R.C.
|
||||
//if( gubMercArray[ i ] != 0 )
|
||||
// return gubMercArray[ i ];
|
||||
if( gProfilesMERC[i].ProfilId != (UINT8)-1 )
|
||||
return gProfilesMERC[i].ProfilId;
|
||||
if( gMercProfiles[i].Type == PROFILETYPE_MERC )
|
||||
return i;
|
||||
notFound = TRUE;//no AIM, no MERC
|
||||
break;
|
||||
case ENC_DATA_FILTER_C_OTHER : // vehicles and electronic 'chars'
|
||||
//if( notFound && IsMercHireable( i ) && i != 254 && Menptr[i].iVehicleId )
|
||||
// return i;
|
||||
if( (filterSubClass == 0 || filterSubClass == 1) && gProfilesVehicle[i].ProfilId != (UINT8)-1 )
|
||||
return gProfilesVehicle[i].ProfilId;
|
||||
if( (filterSubClass == 0 || filterSubClass == 1) && gMercProfiles[i].Type == PROFILETYPE_VEHICLE )
|
||||
return i;
|
||||
if( (filterSubClass == 0 || filterSubClass == 2) && (gMercProfiles[i].ubMiscFlags & PROFILE_MISC_FLAG_EPCACTIVE) )
|
||||
return i;
|
||||
notFound = TRUE;
|
||||
@@ -404,31 +398,25 @@ INT16 GetNextPreviousCharacter( INT16 curChar, BOOLEAN next, ENC_DATA_FILTER_CHA
|
||||
case ENC_DATA_FILTER_C_RPC : // Rebels
|
||||
//if( gMercProfiles[ i ].ubCivilianGroup == REBEL_CIV_GROUP && IsMercHireable( i ) )
|
||||
// return i;//no
|
||||
if( gProfilesRPC[i].ProfilId != (UINT8)-1 )
|
||||
return gProfilesRPC[i].ProfilId;
|
||||
if ( gMercProfiles[i].Type == PROFILETYPE_RPC )
|
||||
return i;
|
||||
notFound = TRUE;
|
||||
break;
|
||||
case ENC_DATA_FILTER_C_NPC : // non hireable characters
|
||||
//if( gMercProfiles[ i ].ubCivilianGroup > NON_CIV_GROUP && gMercProfiles[ i ].ubCivilianGroup != REBEL_CIV_GROUP && !IsMercHireable( i ) )
|
||||
// return i;
|
||||
if( gProfilesNPC[i].ProfilId != (UINT8)-1 )
|
||||
return gProfilesNPC[i].ProfilId;
|
||||
if ( gMercProfiles[i].Type == PROFILETYPE_NPC )
|
||||
return i;
|
||||
notFound = TRUE;
|
||||
break;
|
||||
case ENC_DATA_FILTER_C_IMP : // player created characters
|
||||
//for(UINT impSlot = 0; impSlot < NUM_PROFILES; impSlot++)
|
||||
// if( gGameExternalOptions.iaIMPSlots[ impSlot ] == i )
|
||||
// return i;
|
||||
if( gProfilesIMP[i].ProfilId != (UINT8)-1 )
|
||||
return gProfilesIMP[i].ProfilId;
|
||||
if ( gMercProfiles[i].Type == PROFILETYPE_IMP )
|
||||
return i;
|
||||
notFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return ENC_DATA_NO_DATA;
|
||||
}
|
||||
|
||||
@@ -805,15 +793,17 @@ BOOLEAN CreateData( INT16 newID )
|
||||
}
|
||||
|
||||
// create image
|
||||
if( gProfilesVehicle[newID].ProfilId == newID)
|
||||
{//this is a vehicle
|
||||
if ( gMercProfiles[newID].Type == PROFILETYPE_VEHICLE )
|
||||
{
|
||||
//this is a vehicle
|
||||
std::strcpy( vObjDesc.ImageFile, gNewVehicle[newID].szIconFace );
|
||||
vObjDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
if( !AddVideoObject(&vObjDesc, &gstEncyclopediaDataEntry.uiImageID) )
|
||||
gstEncyclopediaDataEntry.uiImageID = 0;
|
||||
}
|
||||
else
|
||||
{//not vehicle, process normal
|
||||
{
|
||||
//not vehicle, process normal
|
||||
if(gGameExternalOptions.fReadProfileDataFromXML)
|
||||
{
|
||||
// HEADROCK PROFEX: Do not read direct profile number, instead, look inside the profile for a ubFaceIndex value.
|
||||
|
||||
@@ -187,6 +187,7 @@ void CreateACharacterFromPlayerEnteredStats( void )
|
||||
// Flugente: voice set used
|
||||
gMercProfiles[LaptopSaveInfo.iIMPIndex].usVoiceIndex = iSelectedIMPVoiceSet;
|
||||
|
||||
gMercProfiles[LaptopSaveInfo.iIMPIndex].Type = PROFILETYPE_IMP;
|
||||
|
||||
// WDS: Advanced start
|
||||
//gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bExpLevel = gGameExternalOptions.ubIMPStartingLevel;
|
||||
|
||||
@@ -1542,6 +1542,12 @@ BOOLEAN LoadImpCharacter( STR nickName )
|
||||
gMercProfiles[iProfileId].usVoiceIndex = iProfileId;
|
||||
}
|
||||
|
||||
// Flugente: if this is an older savefile, load from separate structure
|
||||
if ( guiCurrentSaveGameVersion < PROFILETYPE_STORED )
|
||||
{
|
||||
gMercProfiles[iProfileId].Type = gProfileType[iProfileId];
|
||||
}
|
||||
|
||||
guiCurrentSaveGameVersion = SAVE_GAME_VERSION;
|
||||
|
||||
// close file
|
||||
|
||||
@@ -476,7 +476,7 @@ BOOLEAN DisplayMercData( UINT8 usProfileA, UINT8 usProfileB )
|
||||
|
||||
// face 1
|
||||
// IMP faces are stored elsewhere
|
||||
if ( gProfilesIMP[usProfileA].ProfilId == usProfileA )
|
||||
if ( gMercProfiles[usProfileA].Type == PROFILETYPE_IMP )
|
||||
{
|
||||
sprintf( sTemp, "IMPFACES\\%02d.sti", gMercProfiles[usProfileA].ubFaceIndex );
|
||||
FilenameForBPP( sTemp, VObjectDesc.ImageFile );
|
||||
@@ -510,7 +510,7 @@ BOOLEAN DisplayMercData( UINT8 usProfileA, UINT8 usProfileB )
|
||||
|
||||
// face 2
|
||||
// IMP faces are stored elsewhere
|
||||
if ( gProfilesIMP[usProfileB].ProfilId == usProfileB )
|
||||
if ( gMercProfiles[usProfileB].Type == PROFILETYPE_IMP )
|
||||
{
|
||||
sprintf( sTemp, "IMPFACES\\%02d.sti", gMercProfiles[usProfileB].ubFaceIndex );
|
||||
FilenameForBPP( sTemp, VObjectDesc.ImageFile );
|
||||
|
||||
+3
-5
@@ -3066,15 +3066,13 @@ void MakeBiffAwayForCoupleOfDays()
|
||||
BOOLEAN AreAnyOfTheNewMercsAvailable()
|
||||
{
|
||||
UINT8 ubMercID;
|
||||
|
||||
|
||||
|
||||
if( LaptopSaveInfo.fNewMercsAvailableAtMercSite )
|
||||
return( FALSE );
|
||||
|
||||
//for(i=(LARRY_NORMAL-BIFF); i<=LaptopSaveInfo.gubLastMercIndex; i++)
|
||||
for(UINT8 i=0; i<NUM_PROFILES; i++)
|
||||
for(UINT8 i=0; i<NUM_PROFILES; ++i)
|
||||
{
|
||||
if ( gConditionsForMercAvailability[i].NewMercsAvailable == FALSE && gProfilesMERC[i].ProfilId != 0 )
|
||||
if ( gConditionsForMercAvailability[i].NewMercsAvailable == FALSE && gMercProfiles[i].Type == PROFILETYPE_MERC )
|
||||
{
|
||||
ubMercID = GetMercIDFromMERCArray( i );
|
||||
if( IsMercMercAvailable( ubMercID ) )
|
||||
|
||||
+8
-13
@@ -838,7 +838,7 @@ void RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired,
|
||||
// special case?..player generated merc
|
||||
if (fCurrentTeamMode)
|
||||
{
|
||||
if ( gProfilesIMP[profileId].ProfilId == profileId )
|
||||
if ( gMercProfiles[profileId].Type == PROFILETYPE_IMP )
|
||||
{
|
||||
sprintf( sTemp, "%s%02d.sti", IMP_FACES_DIR, gMercProfiles[profileId].ubFaceIndex );
|
||||
}
|
||||
@@ -862,7 +862,7 @@ void RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( gProfilesIMP[profileId].ProfilId == profileId )
|
||||
if ( gMercProfiles[profileId].Type == PROFILETYPE_IMP )
|
||||
{
|
||||
sprintf( sTemp, "%s%02d.sti", IMP_FACES_DIR, gMercProfiles[profileId].ubFaceIndex );
|
||||
}
|
||||
@@ -2405,7 +2405,7 @@ void DisplayPicturesOfCurrentTeam( void )
|
||||
|
||||
if ( pSoldier->ubProfile >= 0 )
|
||||
{
|
||||
if ( gProfilesIMP[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile )
|
||||
if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_IMP )
|
||||
{
|
||||
sprintf( sTemp, "%s%02d.sti", IMP_SMALL_FACES_DIR, gMercProfiles[pSoldier->ubProfile].ubFaceIndex );
|
||||
}
|
||||
@@ -4924,24 +4924,20 @@ INT32 GetIdOfPastMercInSlot( INT32 iSlot )
|
||||
for( iCounterA = 0; ( ( ( iCounter ) < ( iSlot + giCurrentUpperLeftPortraitNumber ) ) ); iCounterA++ )
|
||||
{
|
||||
if( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 )
|
||||
iCounter++;
|
||||
++iCounter;
|
||||
}
|
||||
|
||||
return( LaptopSaveInfo.ubOtherCharactersList[ iCounterA - 1] );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void DisplayPortraitOfPastMerc( INT32 iId , INT32 iCounter, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther )
|
||||
{
|
||||
char sTemp[100];
|
||||
HVOBJECT hFaceHandle;
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
if ( gProfilesIMP[iId].ProfilId == iId )
|
||||
if ( gMercProfiles[iId].Type == PROFILETYPE_IMP )
|
||||
{
|
||||
sprintf( sTemp, "%s%02d.sti", IMP_SMALL_FACES_DIR, gMercProfiles[iId].ubFaceIndex );
|
||||
}
|
||||
@@ -5324,10 +5320,9 @@ void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState )
|
||||
{
|
||||
swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_DEAD ] );
|
||||
}
|
||||
|
||||
//if the merc is an AIM merc
|
||||
//else if( iId < BIFF )
|
||||
else if ( gProfilesAIM[ iId ].ProfilId == iId )
|
||||
else if ( gMercProfiles[iId].Type == PROFILETYPE_AIM )
|
||||
{
|
||||
//if dismissed
|
||||
if( iState == DEPARTED_FIRED )
|
||||
@@ -5338,7 +5333,7 @@ void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState )
|
||||
|
||||
//else if its a MERC merc
|
||||
//else if( iId >= BIFF && iId <= BUBBA )
|
||||
else if ( gProfilesMERC[ iId ].ProfilId == iId )
|
||||
else if ( gMercProfiles[iId].Type == PROFILETYPE_MERC )
|
||||
{
|
||||
if( iState == DEPARTED_FIRED )
|
||||
swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_FIRED ] );
|
||||
@@ -5347,7 +5342,7 @@ void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState )
|
||||
}
|
||||
//must be a RPC
|
||||
//else
|
||||
else if ( gProfilesRPC[ iId ].ProfilId == iId )
|
||||
else if ( gMercProfiles[iId].Type == PROFILETYPE_RPC )
|
||||
{
|
||||
if( iState == DEPARTED_FIRED )
|
||||
swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_FIRED ] );
|
||||
|
||||
Reference in New Issue
Block a user