diff --git a/GameVersion.h b/GameVersion.h index 00ce212c..7e5e310e 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -22,6 +22,7 @@ extern CHAR16 zRevisionNumber[16]; // Keeps track of the saved game version. Increment the saved game version whenever // you will invalidate the saved game file +#define PROFILETYPE_STORED 180 // Flugente: the type of each profile is stored in the savegame #define CORPSE_DISPOSAL 179 // Flugente: corpses can be removed by assignment #define RAID_EVENTS 178 // Flugente: added bloodcat/zombie/bandit raids #define INDIVIDUAL_MILITIA_EXP_FLOAT 177 // Flugente: changed the way we store individual militia experience @@ -99,7 +100,7 @@ extern CHAR16 zRevisionNumber[16]; #define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes #define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system -#define SAVE_GAME_VERSION CORPSE_DISPOSAL +#define SAVE_GAME_VERSION PROFILETYPE_STORED //#define RUSSIANGOLD #ifdef __cplusplus diff --git a/Laptop/DynamicDialogueWidget.cpp b/Laptop/DynamicDialogueWidget.cpp index 4e9cd599..f7395443 100644 --- a/Laptop/DynamicDialogueWidget.cpp +++ b/Laptop/DynamicDialogueWidget.cpp @@ -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 ); } diff --git a/Laptop/Encyclopedia_Data_new.cpp b/Laptop/Encyclopedia_Data_new.cpp index dfe28a5b..3f95602b 100644 --- a/Laptop/Encyclopedia_Data_new.cpp +++ b/Laptop/Encyclopedia_Data_new.cpp @@ -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. diff --git a/Laptop/IMP Compile Character.cpp b/Laptop/IMP Compile Character.cpp index fb55dbbe..abd5947c 100644 --- a/Laptop/IMP Compile Character.cpp +++ b/Laptop/IMP Compile Character.cpp @@ -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; diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index 28b602ad..a2149bf6 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -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 diff --git a/Laptop/merccompare.cpp b/Laptop/merccompare.cpp index 09193653..4f8c029f 100644 --- a/Laptop/merccompare.cpp +++ b/Laptop/merccompare.cpp @@ -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 ); diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp index e796b9e2..899ffe02 100644 --- a/Laptop/mercs.cpp +++ b/Laptop/mercs.cpp @@ -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; iubProfile >= 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 ] ); diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index afd56cb6..eea04f87 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -1638,6 +1638,15 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for return(FALSE); } } + + // Flugente: if this is a an case of older file, load from separate structure + if ( guiCurrentSaveGameVersion >= PROFILETYPE_STORED ) + { + if ( !FileRead( hFile, &this->Type, sizeof( UINT32 ), &uiNumBytesRead ) ) + { + return( FALSE ); + } + } } if ( this->uiProfileChecksum != this->GetChecksum() ) @@ -1749,6 +1758,11 @@ BOOLEAN MERCPROFILESTRUCT::Save(HWFILE hFile) { return(FALSE); } + + if ( !FileWrite( hFile, &this->Type, sizeof( UINT32 ), &uiNumBytesWritten ) ) + { + return( FALSE ); + } return TRUE; } @@ -4349,16 +4363,6 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "New Mercs Profiles" ); #endif - //New system profiles by Jazz - if( !SaveNewSystemMercsToSaveGameFile( hFile ) ) - { - ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing new system mercs profiles"); - goto FAILED_TO_SAVE; - } - #ifdef JA2BETAVERSION - SaveGameFilePosition( FileGetPos( hFile ), "New system Mercs Profiles" ); - #endif - //save lua global if( !SaveLuaGlobalToSaveGameFile( hFile ) ) { @@ -5981,7 +5985,8 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) RenderProgressBar( 0, 100 ); uiRelStartPerc = uiRelEndPerc; - if( guiCurrentSaveGameVersion >= 113 ) + // Flugente: we don't need this data anymore, but need to account for older save files + if ( guiCurrentSaveGameVersion >= 113 && guiCurrentSaveGameVersion < PROFILETYPE_STORED ) { if( !LoadNewSystemMercsToSaveGameFile( hFile ) ) { @@ -6714,11 +6719,17 @@ BOOLEAN LoadSavedMercProfiles( HWFILE hFile ) if ( gMercProfiles[cnt].bLifeMax <= 0 ) gMercProfiles[cnt] = tempMercProfile; - /// Flugente: until the introduction of a separate varriable for the voiceset, the voice was identical with the slot + // Flugente: until the introduction of a separate varriable for the voiceset, the voice was identical with the slot if ( guiCurrentSaveGameVersion < SEPARATE_VOICESETS ) { gMercProfiles[cnt].usVoiceIndex = cnt; } + + // Flugente: if this is an older savefile, load from separate structure + if ( guiCurrentSaveGameVersion < PROFILETYPE_STORED ) + { + gMercProfiles[cnt].Type = gProfileType[cnt]; + } } return( TRUE ); diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index de2cf8fc..ad86483e 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -8731,9 +8731,8 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) } // RPCs get a small training bonus for being more familiar with the locals and their customs/needs than outsiders - //new profiles by Jazz - //if( pTrainer->ubProfile >= FIRST_RPC ) - if ( gProfilesRPC[pTrainer->ubProfile].ProfilId == pTrainer->ubProfile || gProfilesNPC[pTrainer->ubProfile].ProfilId == pTrainer->ubProfile ) + if ( gMercProfiles[pTrainer->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[pTrainer->ubProfile].Type == PROFILETYPE_NPC ) { sTrainingBonus += gGameExternalOptions.ubRpcBonusToTrainMilitia; } diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index a41db8df..a3ddb959 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -2103,21 +2103,17 @@ void CreateAutoResolveInterface() } //add all the faces now - for( i = 0; i < gpAR->ubMercs; i++ ) + for( i = 0; i < gpAR->ubMercs; ++i ) { VOBJECT_DESC VObjectDesc; //Load the face VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - - /* - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ gpMercs[ i ].pSoldier->ubProfile ].ubFaceIndex ); - */ - - if ( ( gpMercs[ i ].pSoldier->ubProfile >= 0 ) && ( gpMercs[ i ].pSoldier->ubProfile < 100 ) && ( gProfilesIMP[ gpMercs[ i ].pSoldier->ubProfile ].ProfilId == gpMercs[ i ].pSoldier->ubProfile ) ) + + if ( ( gpMercs[ i ].pSoldier->ubProfile >= 0 ) && ( gpMercs[ i ].pSoldier->ubProfile < 100 ) && gMercProfiles[gpMercs[i].pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ gpMercs[ i ].pSoldier->ubProfile ].ubFaceIndex ); } - else if ( ( gpMercs[ i ].pSoldier->ubProfile > 99 ) && ( gProfilesIMP[ gpMercs[ i ].pSoldier->ubProfile ].ProfilId == gpMercs[ i ].pSoldier->ubProfile ) ) + else if ( ( gpMercs[ i ].pSoldier->ubProfile > 99 ) && gMercProfiles[gpMercs[i].pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ gpMercs[ i ].pSoldier->ubProfile ].ubFaceIndex ); } @@ -2139,7 +2135,6 @@ void CreateAutoResolveInterface() } } - if( GetVideoObject( &hVObject, gpMercs[ i ].uiVObjectID ) ) { hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 255, 255, 255, FALSE ); diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 0a954c36..42c33a8b 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -2091,30 +2091,9 @@ static int l_WhoIs (lua_State *L) UINT8 whois = lua_tointeger(L,1); UINT8 Val = lua_tointeger(L,2); UINT8 Prof = 0; - - switch ( whois ) - { - case 1: - Prof = gProfilesAIM[ Val ].ProfilId; - break; - case 2: - Prof = gProfilesMERC[ Val ].ProfilId; - break; - case 3: - Prof = gProfilesRPC[ Val ].ProfilId; - break; - case 4: - Prof = gProfilesNPC[ Val ].ProfilId; - break; - case 5: - Prof = gProfilesVehicle[ Val ].ProfilId; - break; - case 6: - Prof = gProfilesIMP[ Val ].ProfilId; - break; - default: - break; - } + + if ( gMercProfiles[Val].Type == whois ) + Prof = Val; lua_pushinteger(L, Prof); } @@ -2124,8 +2103,7 @@ static int l_WhoIs (lua_State *L) #ifdef JA2UB static int l_HandlePlayerHittingSwitchToLaunchMissles (lua_State *L) -{ - +{ HandlePlayerHittingSwitchToLaunchMissles( ); return 0; @@ -8171,7 +8149,7 @@ static int l_AddEmailXML ( lua_State *L ) if ( uiIndex != 0 ) pMerc = uiIndex + 1; - if ( gProfilesAIM[uiIndex].ProfilId == uiIndex ) + if ( gMercProfiles[uiIndex].Type == PROFILETYPE_AIM ) AddEmailTypeXML( pMerc, uiIndex, uiIndex, GetWorldTotalMin(), -1, TYPE_EMAIL_AIM_AVAILABLE ); } @@ -8188,8 +8166,8 @@ static int l_AddEmailLevelUpXML (lua_State *L) UINT8 pMerc = 0; if ( uiIndex != 0 ) pMerc = uiIndex + 1; - - if ( gProfilesMERC[uiIndex].ProfilId == uiIndex ) + + if ( gMercProfiles[uiIndex].Type == PROFILETYPE_MERC ) AddEmailTypeXML( pMerc, uiIndex, uiIndex, GetWorldTotalMin(), -1, TYPE_EMAIL_MERC_LEVEL_UP ); } diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 2b3275ca..c6db627d 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -4929,11 +4929,11 @@ void AddSoldierToUpdateBox( SOLDIERTYPE *pSoldier ) - if ( ( gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex < 100 ) && ( gProfilesIMP[ pSoldier->ubProfile ].ProfilId == pSoldier->ubProfile ) ) + if ( ( gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex < 100 ) && gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex ); } - else if ( ( gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex > 99 ) && ( gProfilesIMP[ pSoldier->ubProfile ].ProfilId == pSoldier->ubProfile ) ) + else if ( ( gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex > 99 ) && gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex ); } diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index 8515fd9a..e2218834 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -1196,9 +1196,7 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi } //if the character is an RPC - //if( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < FIRST_NPC ) - //new profiles by Jazz - if ( gProfilesRPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile ) + if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_RPC ) { if( gMercProfiles[ pSoldier->ubProfile ].bSex == MALE ) { @@ -1210,7 +1208,6 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi } fInSector = TRUE; } - // check if drassen controlled else if( StrategicMap[ ( AIRPORT_X + ( MAP_WORLD_X * AIRPORT_Y ) ) ].fEnemyControlled == FALSE ) { @@ -1242,7 +1239,6 @@ void NotifyPlayerOfMercDepartureAndPromptEquipmentPlacement( SOLDIERTYPE *pSoldi { swprintf( sString, pMercSheLeaveString[ 0 ], pSoldier->GetName(), zShortTownIDString, zDropOffString ); } - } } else diff --git a/Strategic/Quest Debug System.cpp b/Strategic/Quest Debug System.cpp index ceb0c03b..7a92c874 100644 --- a/Strategic/Quest Debug System.cpp +++ b/Strategic/Quest Debug System.cpp @@ -3297,25 +3297,24 @@ void AddNPCsInSectorToArray() //Setup array of merc who are in the current sector i=0; - for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ ) + for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; ++pSoldier, ++cnt ) { if ( ( pSoldier != NULL ) && pSoldier->bActive ) { //if soldier is a NPC, add him to the local NPC array - //if( ( pSoldier->ubProfile >= FIRST_RPC ) && ( pSoldier->ubProfile < GASTON ) ) - //new profiles by Jazz - if ( gProfilesRPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesNPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesVehicle[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile ) + if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_NPC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_VEHICLE ) { gubCurrentNpcInSector[ i ] = pSoldier->ubProfile; i++; } } - } + gubNumNPCinSector = (UINT8)i; } - void ChangeQuestState( INT32 iNumber ) { if( ( iNumber >= 0 ) && ( iNumber <= 2 ) ) @@ -3695,15 +3694,15 @@ void RefreshAllNPCInventory() UINT16 usItemCnt; UINT16 usItem; - for ( usCnt=0; usCnt < TOTAL_SOLDIERS; usCnt++ ) + for ( usCnt=0; usCnt < TOTAL_SOLDIERS; ++usCnt ) { //if the is active if( Menptr[ usCnt ].bActive == 1 ) { //is the merc a rpc or npc - //if( Menptr[ usCnt ].ubProfile >= FIRST_RPC && Menptr[ usCnt ].ubProfile < GASTON ) - //new profiles by Jazz - if ( gProfilesRPC[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile || gProfilesNPC[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile || gProfilesVehicle[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile ) + if ( gMercProfiles[usCnt].Type == PROFILETYPE_RPC || + gMercProfiles[usCnt].Type == PROFILETYPE_NPC || + gMercProfiles[usCnt].Type == PROFILETYPE_VEHICLE ) { //refresh the mercs inventory UINT16 invsize = Menptr[ usCnt ].inv.size(); @@ -3988,9 +3987,9 @@ UINT8 WhichPanelShouldTalkingMercUse( ) return( QDS_NO_PANEL ); } - //if( gTalkingMercSoldier->ubProfile < FIRST_RPC || gTalkingMercSoldier->ubProfile >= GASTON ) - //new profiles by Jazz - if ( gProfilesAIM[gTalkingMercSoldier->ubProfile].ProfilId == gTalkingMercSoldier->ubProfile || gProfilesMERC[gTalkingMercSoldier->ubProfile].ProfilId == gTalkingMercSoldier->ubProfile || gProfilesIMP[gTalkingMercSoldier->ubProfile].ProfilId == gTalkingMercSoldier->ubProfile ) + if ( gMercProfiles[gTalkingMercSoldier->ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[gTalkingMercSoldier->ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[gTalkingMercSoldier->ubProfile].Type == PROFILETYPE_IMP ) { return( QDS_REGULAR_PANEL ); } diff --git a/Strategic/Strategic Event Handler.cpp b/Strategic/Strategic Event Handler.cpp index 8fe06f28..5a9bb9c9 100644 --- a/Strategic/Strategic Event Handler.cpp +++ b/Strategic/Strategic Event Handler.cpp @@ -853,11 +853,11 @@ void HandleEarlyMorningEvents( void ) UINT32 uiAmount; // loop through all *NPCs* and reset "default response used recently" flags - //for (cnt = FIRST_RPC; cnt < GASTON; cnt++) - for (cnt = 0; cnt < NUM_PROFILES; cnt++) + for (cnt = 0; cnt < NUM_PROFILES; ++cnt) { - //new profiles by Jazz - if ( gProfilesRPC[cnt].ProfilId == cnt || gProfilesNPC[cnt].ProfilId == cnt || gProfilesVehicle[cnt].ProfilId == cnt ) + if ( gMercProfiles[cnt].Type == PROFILETYPE_RPC || + gMercProfiles[cnt].Type == PROFILETYPE_NPC || + gMercProfiles[cnt].Type == PROFILETYPE_VEHICLE ) { gMercProfiles[cnt].bFriendlyOrDirectDefaultResponseUsedRecently = FALSE; gMercProfiles[cnt].bRecruitDefaultResponseUsedRecently = FALSE; @@ -886,7 +886,6 @@ void HandleEarlyMorningEvents( void ) } } - if( gMercProfiles[ TONY ].ubLastDateSpokenTo > 0 && !( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) ) { // San Mona C5 is not loaded so make Tony possibly not availableif @@ -906,7 +905,6 @@ void HandleEarlyMorningEvents( void ) } } - if ( gMercProfiles[ DEVIN ].ubLastDateSpokenTo == 0 ) { // Does Devin move? diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index 6b6ccaf5..53ece17b 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -219,15 +219,12 @@ void MercDailyUpdate() AddSameDayStrategicEvent( EVENT_BEGIN_CONTRACT_RENEWAL_SEQUENCE, MERC_ARRIVE_TIME_SLOT_1, 0 ); AddSameDayStrategicEvent( EVENT_BEGIN_CONTRACT_RENEWAL_SEQUENCE, MERC_ARRIVE_TIME_SLOT_2, 0 ); AddSameDayStrategicEvent( EVENT_BEGIN_CONTRACT_RENEWAL_SEQUENCE, MERC_ARRIVE_TIME_SLOT_3, 0 ); - - + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - - - + //loop though all the mercs - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; ++cnt,++pSoldier) { //if the merc is active if ( ( pSoldier->bActive )&&( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != IN_TRANSIT ) ) @@ -246,7 +243,7 @@ void MercDailyUpdate() if ( pSoldier->bCorpseQuoteTolerance < 0 ) { - pSoldier->bCorpseQuoteTolerance = 0; + pSoldier->bCorpseQuoteTolerance = 0; } // CJC: For some personalities, reset personality quote said flag @@ -266,8 +263,7 @@ void MercDailyUpdate() break; } } - - + //ATE: Try to see if our equipment sucks! if ( SoldierHasWorseEquipmentThanUsedTo( pSoldier ) ) { @@ -280,16 +276,13 @@ void MercDailyUpdate() // player has hired him, so he'll eligible to get killed off on another job gMercProfiles[pSoldier->ubProfile].ubMiscFlags3 |= PROFILE_MISC_FLAG3_PLAYER_HAD_CHANCE_TO_HIRE; - - + //handle Slay differently if SlayForever is enabled if( pSoldier->ubProfile == SLAY && gGameExternalOptions.fEnableSlayForever == TRUE) { } //if the character is an RPC - //else if( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < FIRST_NPC ) - //new profiles by Jazz - else if ( gProfilesRPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile ) + else if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_RPC ) { INT16 sSalary = gMercProfiles[ pSoldier->ubProfile ].sSalary; INT32 iMoneyOwedToMerc = 0; @@ -488,12 +481,13 @@ void MercDailyUpdate() { oMerc = cnt; iMerc = oMerc * 1; - + if ( oMerc != 0 ) pMerc = oMerc + 1; else pMerc = 0; - if ( gProfilesAIM[cnt].ProfilId == cnt ) + + if ( gMercProfiles[cnt].Type == PROFILETYPE_AIM ) AddEmailTypeXML( pMerc, iMerc, iMerc, GetWorldTotalMin(), -1 , TYPE_EMAIL_AIM_AVAILABLE); } else @@ -541,8 +535,7 @@ void MercDailyUpdate() if( IsProfileIdAnAimOrMERCMerc( (UINT8)cnt ) ) { // check to see if he goes on another assignment - //if (cnt < MAX_NUMBER_MERCS) - if ( gProfilesAIM[ cnt ].ProfilId == cnt ) //new profiles by Jazz + if ( gMercProfiles[cnt].Type == PROFILETYPE_AIM ) { // A.I.M. merc uiChance = 2 * pProfile->bExpLevel; @@ -550,7 +543,7 @@ void MercDailyUpdate() // player has now had a chance to hire him, so he'll eligible to get killed off on another job pProfile->ubMiscFlags3 |= PROFILE_MISC_FLAG3_PLAYER_HAD_CHANCE_TO_HIRE; } - else if ( gProfilesMERC[ cnt ].ProfilId == cnt ) //new profiles by Jazz + else if ( gMercProfiles[cnt].Type == PROFILETYPE_MERC ) { // M.E.R.C. merc - very rarely get other work uiChance = 1 * pProfile->bExpLevel; @@ -562,6 +555,7 @@ void MercDailyUpdate() pProfile->ubMiscFlags3 |= PROFILE_MISC_FLAG3_PLAYER_HAD_CHANCE_TO_HIRE; } } + // tais: disable mercs being on assignment if (Random(100) < uiChance && gGameExternalOptions.fMercsOnAssignment < 2) { @@ -577,8 +571,7 @@ void MercDailyUpdate() pProfile->ubDaysOfMoraleHangover--; } } - - + // build quit list //BuildMercQuitList( pQuitList ); #ifdef JA2UB @@ -1506,8 +1499,7 @@ void HandleAddingAnyAimAwayEmailsWhenLaptopGoesOnline() UINT32 cnt; INT32 iOffset; MERCPROFILESTRUCT *pProfile; - - + //Loop through all the profiles for( cnt = 0; cnt < NUM_PROFILES; cnt++) { @@ -1539,13 +1531,14 @@ void HandleAddingAnyAimAwayEmailsWhenLaptopGoesOnline() pMerc = oMerc + 1; else pMerc = 0; - if ( gProfilesAIM[cnt].ProfilId == cnt ) + + if ( gMercProfiles[cnt].Type == PROFILETYPE_AIM ) AddEmailTypeXML( pMerc, iMerc, iMerc, GetWorldTotalMin(), -1 , TYPE_EMAIL_AIM_AVAILABLE); } else { - // TO DO: send E-mail to player telling him the merc has returned from an assignment - AddEmail( ( UINT8 )( iOffset + ( cnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + cnt ), GetWorldTotalMin(),-1 ,-1, TYPE_EMAIL_EMAIL_EDT_NAME_MERC); + // TO DO: send E-mail to player telling him the merc has returned from an assignment + AddEmail( ( UINT8 )( iOffset + ( cnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + cnt ), GetWorldTotalMin(),-1 ,-1, TYPE_EMAIL_EMAIL_EDT_NAME_MERC); } } } diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index ad97423c..30af1eec 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -5720,17 +5720,19 @@ BOOLEAN HandlePlayerGroupEnteringSectorToCheckForNPCsOfNote( GROUP *pGroup ) BOOLEAN WildernessSectorWithAllProfiledNPCsNotSpokenWith( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { - UINT8 ubProfile; MERCPROFILESTRUCT * pProfile; BOOLEAN fFoundSomebody = FALSE; - - //for ( ubProfile = FIRST_RPC; ubProfile < GASTON; ubProfile++ ) - //new profiles by Jazz - for ( ubProfile = 0; ubProfile < NUM_PROFILES; ubProfile++ ) - { - - if ( gProfilesRPC[ubProfile].ProfilId == ubProfile || gProfilesNPC[ubProfile].ProfilId == ubProfile || gProfilesVehicle[ubProfile].ProfilId == ubProfile) + for ( UINT32 ubProfile = 0; ubProfile < NUM_PROFILES; ++ubProfile ) + { + // skip vehicles + if ( gMercProfiles[ubProfile].Type == PROFILETYPE_VEHICLE ) + { + continue; + } + + if ( gMercProfiles[ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[ubProfile].Type == PROFILETYPE_NPC ) { pProfile = &gMercProfiles[ ubProfile ]; @@ -5739,14 +5741,7 @@ BOOLEAN WildernessSectorWithAllProfiledNPCsNotSpokenWith( INT16 sSectorX, INT16 { continue; } - - // skip vehicles - //if ( ubProfile >= PROF_HUMMER && ubProfile <= PROF_HELICOPTER ) - if ( gProfilesVehicle[ubProfile].ProfilId == ubProfile ) - { - continue; - } - + // in this sector? if ( pProfile->sSectorX == sSectorX && pProfile->sSectorY == sSectorY && pProfile->bSectorZ == bSectorZ ) { diff --git a/Strategic/strategic town reputation.cpp b/Strategic/strategic town reputation.cpp index 53965f6d..2b7294c9 100644 --- a/Strategic/strategic town reputation.cpp +++ b/Strategic/strategic town reputation.cpp @@ -36,15 +36,16 @@ void InitializeProfilesForTownReputation( void ) { - UINT32 uiProfileId = 0; - // initialize the town opinion values in each recruitable merc's profile structure //for( uiProfileId = 0; uiProfileId < FIRST_NPC; uiProfileId++ ) //new profiles by Jazz - for( uiProfileId = 0; uiProfileId < NUM_PROFILES; uiProfileId++ ) + for( UINT32 uiProfileId = 0; uiProfileId < NUM_PROFILES; ++uiProfileId ) { - if ( gProfilesIMP[uiProfileId].ProfilId == uiProfileId || gProfilesRPC[uiProfileId].ProfilId == uiProfileId || gProfilesAIM[uiProfileId].ProfilId == uiProfileId || gProfilesMERC[uiProfileId].ProfilId == uiProfileId) - memset( &( gMercProfiles[ uiProfileId ].bMercTownReputation ), INITIAL_TOWN_REPUTATION, sizeof( gMercProfiles[ uiProfileId ].bMercTownReputation ) ); + if ( gMercProfiles[uiProfileId].Type == PROFILETYPE_AIM || + gMercProfiles[uiProfileId].Type == PROFILETYPE_MERC || + gMercProfiles[uiProfileId].Type == PROFILETYPE_RPC || + gMercProfiles[uiProfileId].Type == PROFILETYPE_IMP ) + memset( &( gMercProfiles[ uiProfileId ].bMercTownReputation ), INITIAL_TOWN_REPUTATION, sizeof( gMercProfiles[ uiProfileId ].bMercTownReputation ) ); } } @@ -131,22 +132,22 @@ void UpdateTownOpinionOfThisMercForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubTownI void HandleSpreadOfAllTownsOpinion( void ) { - UINT8 ubProfileId; - // debug message ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"%s - Spreading town opinions about mercs", WORLDTIMESTR ); // run though all player-recruitable profiles and update towns opinion of mercs //for( ubProfileId = 0; ubProfileId < FIRST_NPC; ubProfileId++ ) //new profiles by Jazz - for( ubProfileId = 0; ubProfileId < NUM_PROFILES; ubProfileId++ ) + for( int ubProfileId = 0; ubProfileId < NUM_PROFILES; ++ubProfileId ) { - if ( gProfilesIMP[ubProfileId].ProfilId == ubProfileId || gProfilesAIM[ubProfileId].ProfilId == ubProfileId || gProfilesMERC[ubProfileId].ProfilId == ubProfileId || gProfilesRPC[ubProfileId].ProfilId == ubProfileId) - HandleSpreadOfTownOpinionForMerc( ubProfileId ); + if ( gMercProfiles[ubProfileId].Type == PROFILETYPE_AIM || + gMercProfiles[ubProfileId].Type == PROFILETYPE_MERC || + gMercProfiles[ubProfileId].Type == PROFILETYPE_RPC || + gMercProfiles[ubProfileId].Type == PROFILETYPE_IMP ) + HandleSpreadOfTownOpinionForMerc( ubProfileId ); } } - void HandleSpreadOfTownOpinionForMerc( UINT8 ubProfileId ) { // handle opinion spread for this grunt diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index 213aa5ab..86efd46a 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -1029,17 +1029,15 @@ BOOLEAN AddFacesToAutoBandageBox( void ) VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) + for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter ) { // find a free slot if( iDoctorList[ iCounter ] != -1 ) { - - if( gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) { // grab filename of face - if ((iDoctorList[ iCounter ] != -1) && ( gProfilesIMP[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile )) + if ((iDoctorList[ iCounter ] != -1) && gMercProfiles[( Menptr[iDoctorList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); else sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); @@ -1047,56 +1045,20 @@ BOOLEAN AddFacesToAutoBandageBox( void ) else { // grab filename of face - if ((iDoctorList[ iCounter ] != -1) && ( gProfilesIMP[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile )) + if ((iDoctorList[ iCounter ] != -1) && gMercProfiles[( Menptr[iDoctorList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); else sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); } - - - /* - if ( ( gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) && ( gProfilesIMP[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else if ( ( gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex > 99 ) && ( gProfilesIMP[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else if(( gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) && ( gProfilesIMP[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ProfilId == -1 )) - { - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else if(( gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex > 99 ) && ( gProfilesIMP[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ProfilId == -1 )) - { - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - - - if( gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) - { - // grab filename of face - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else - { - // grab filename of face - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - */ // load the face - // AddVideoObject( &VObjectDesc, (UINT32 *)&giAutoBandagesSoldierFaces[ iCounter ] ); - if( !AddVideoObject( &VObjectDesc, (UINT32 *)&giAutoBandagesSoldierFaces[ iCounter ] ) ) { sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\speck.sti" ); AddVideoObject( &VObjectDesc, (UINT32 *)&giAutoBandagesSoldierFaces[ iCounter ] ); - } - iNumberOfDoctors++; - + ++iNumberOfDoctors; } } @@ -1105,11 +1067,10 @@ BOOLEAN AddFacesToAutoBandageBox( void ) // find a free slot if( iPatientList[ iCounter ] != -1 ) { - if( gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) { // grab filename of face - if ((iPatientList[ iCounter ] != -1) && ( gProfilesIMP[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile )) + if ((iPatientList[ iCounter ] != -1) && gMercProfiles[( Menptr[iPatientList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); else sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); @@ -1117,56 +1078,22 @@ BOOLEAN AddFacesToAutoBandageBox( void ) else { // grab filename of face - if ((iPatientList[ iCounter ] != -1) && ( gProfilesIMP[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile )) + if ( (iPatientList[ iCounter ] != -1) && gMercProfiles[( Menptr[iPatientList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); else sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); } - /* - if ( ( gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) && ( gProfilesIMP[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else if ( ( gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex > 99 ) && ( gProfilesIMP[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ProfilId == ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else if(( gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) && ( gProfilesIMP[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ProfilId == -1 )) - { - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else if(( gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex > 99 ) && ( gProfilesIMP[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ProfilId == -1 )) - { - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - - - if( gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) - { - // grab filename of face - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - else - { - // grab filename of face - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); - } - */ // load the face - // AddVideoObject( &VObjectDesc, (UINT32 *)&giAutoBandagesSoldierFaces[ iCounter + iNumberOfDoctors ] ); - if( !AddVideoObject( &VObjectDesc, (UINT32 *)&giAutoBandagesSoldierFaces[ iCounter + iNumberOfDoctors ] ) ) { sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\speck.sti" ); AddVideoObject( &VObjectDesc, (UINT32 *)&giAutoBandagesSoldierFaces[ iCounter + iNumberOfDoctors ] ); - } - } } - // grab panels + // grab panels VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; sprintf( VObjectDesc.ImageFile, "Interface\\panels.sti" ); if( !AddVideoObject( &VObjectDesc, (UINT32 *)&giMercPanelImage ) ) diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 8f08ca4d..beac53b9 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1352,19 +1352,18 @@ void HandleUnhiredMercDeaths( INT32 iProfileID ) // keep count of how many there have been gStrategicStatus.ubUnhiredMercDeaths++; - + //send an email as long as the merc is from aim #ifdef JA2UB //ja25 ub if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) { - if ( gProfilesAIM[ iProfileID ].ProfilId == iProfileID && gGameUBOptions.fDeadMerc == TRUE ) //new profiles by Jazz + if ( gMercProfiles[iProfileID].Type == PROFILETYPE_AIM && gGameUBOptions.fDeadMerc == TRUE ) //new profiles by Jazz //send an email to the player telling the player that a merc died AddEmailWithSpecialData(206, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, iProfileID, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L1 ); } #else - // if( iProfileID < BIFF ) - if ( gProfilesAIM[ iProfileID ].ProfilId == iProfileID ) //new profiles by Jazz + if ( gMercProfiles[iProfileID].Type == PROFILETYPE_AIM ) { //send an email to the player telling the player that a merc died AddEmailWithSpecialData(MERC_DIED_ON_OTHER_ASSIGNMENT, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, iProfileID, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); @@ -2021,7 +2020,8 @@ void MERCMercWentUpALevelSendEmail( UINT8 ubMercMercIdValue ) pMerc = oMerc + 1; else pMerc = 0; - if ( gProfilesMERC[ubMercMercIdValue].ProfilId == ubMercMercIdValue ) + + if ( gMercProfiles[ubMercMercIdValue].Type == PROFILETYPE_MERC ) if( IsSpeckComAvailable() )// anv: only send level up email if Speck is available at website AddEmailTypeXML( pMerc, iMerc, iMerc, GetWorldTotalMin(), -1 , TYPE_EMAIL_MERC_LEVEL_UP); } diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 24f98aaa..93953b9f 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -2338,9 +2338,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN sprintf( zFileName, "NPCDATA\\d_%03d.EDT", usVoiceSet ); } } - //else if ( ubCharacterNum >= FIRST_RPC && ubCharacterNum < GASTON && - //new profiles by Jazz - else if ( ( gProfilesRPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesNPC[ubCharacterNum].ProfilId == ubCharacterNum ) && //|| gProfilesVehicle[ubCharacterNum].ProfilId == ubCharacterNum ) && + else if ( ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_NPC ) && ( !( gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) || ProfileCurrentlyTalkingInDialoguePanel( ubCharacterNum ) || (gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_FORCENPCQUOTE) ) @@ -2420,9 +2418,9 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN if ( fWavFile ) { #ifdef RUSSIAN - // if( ubCharacterNum >= FIRST_RPC && ubCharacterNum < GASTON && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) - //new profiles by Jazz - if ( ( gProfilesRPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesNPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesVehicle[ubCharacterNum].ProfilId == ubCharacterNum ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) + if ( ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || + gMercProfiles[ubCharacterNum].Type == PROFILETYPE_NPC || + gMercProfiles[ubCharacterNum].Type == PROFILETYPE_VEHICLE ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) { //inshy: fix for UB-1.13 version only sprintf( zFileName,"SPEECH\\r_%03d_%03d.ogg",ubCharacterNum,usQuoteNum ); if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE ) diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index d9d85192..7558ada5 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -182,17 +182,15 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF { iFaceFileID = 151; } - - + // Check if we are a big-face.... if ( uiInitFlags & FACE_BIGFACE ) - { - - if ( ( iFaceFileID < 100 ) && ( gProfilesIMP[ usMercProfileID ].ProfilId == usMercProfileID ) ) + { + if ( ( iFaceFileID < 100 ) && ( gMercProfiles[usMercProfileID].Type == PROFILETYPE_IMP ) ) { sprintf( VObjectDesc.ImageFile, "IMPFACES\\b%02d.sti", iFaceFileID ); } - else if ( ( iFaceFileID > 99 ) && ( gProfilesIMP[ usMercProfileID ].ProfilId == usMercProfileID ) ) + else if ( ( iFaceFileID > 99 ) && ( gMercProfiles[usMercProfileID].Type == PROFILETYPE_IMP ) ) { sprintf( VObjectDesc.ImageFile, "IMPFACES\\b%03d.sti", iFaceFileID ); } @@ -204,18 +202,7 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF { sprintf( VObjectDesc.ImageFile, "FACES\\b%03d.sti", iFaceFileID ); } - - /* - // The filename is the profile ID! - if( iFaceFileID < 100 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\b%02d.sti", iFaceFileID ); - } - else - { - sprintf( VObjectDesc.ImageFile, "FACES\\b%03d.sti", iFaceFileID ); - } - */ + // ATE: Check for profile - if elliot , use special face :) if ( usMercProfileID == ELLIOT ) { @@ -283,14 +270,11 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF } else { - if (gGameExternalOptions.fShowCamouflageFaces == TRUE ) { - - - if ( ( iFaceFileID < 100 ) && ( gProfilesIMP[ usMercProfileID ].ProfilId == usMercProfileID ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFACES\\%02d.sti", iFaceFileID ); + if ( ( iFaceFileID < 100 ) && ( gMercProfiles[usMercProfileID].Type == PROFILETYPE_IMP ) ) + { + sprintf( VObjectDesc.ImageFile, "IMPFACES\\%02d.sti", iFaceFileID ); if ( gCamoFace[usMercProfileID].gCamoface == TRUE ) { @@ -309,12 +293,12 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF sprintf( VObjectDesc.ImageFile, "IMPFACES\\SnowCamo\\%02d.sti", iFaceFileID ); } - if (!FileExists(VObjectDesc.ImageFile)) - sprintf( VObjectDesc.ImageFile, "IMPFACES\\%02d.sti", iFaceFileID ); - } - else if ( ( iFaceFileID > 99 ) && ( gProfilesIMP[ usMercProfileID ].ProfilId == usMercProfileID ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFACES\\%03d.sti", iFaceFileID ); + if (!FileExists(VObjectDesc.ImageFile)) + sprintf( VObjectDesc.ImageFile, "IMPFACES\\%02d.sti", iFaceFileID ); + } + else if ( ( iFaceFileID > 99 ) && ( gMercProfiles[usMercProfileID].Type == PROFILETYPE_IMP ) ) + { + sprintf( VObjectDesc.ImageFile, "IMPFACES\\%03d.sti", iFaceFileID ); if ( gCamoFace[usMercProfileID].gCamoface == TRUE ) { @@ -333,12 +317,12 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF sprintf( VObjectDesc.ImageFile, "IMPFACES\\SnowCamo\\%03d.sti", iFaceFileID ); } - if (!FileExists(VObjectDesc.ImageFile)) - sprintf( VObjectDesc.ImageFile, "IMPFACES\\%03d.sti", iFaceFileID ); - } - else if( iFaceFileID < 100 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\%02d.sti", iFaceFileID ); + if (!FileExists(VObjectDesc.ImageFile)) + sprintf( VObjectDesc.ImageFile, "IMPFACES\\%03d.sti", iFaceFileID ); + } + else if( iFaceFileID < 100 ) + { + sprintf( VObjectDesc.ImageFile, "FACES\\%02d.sti", iFaceFileID ); if ( gCamoFace[usMercProfileID].gCamoface == TRUE ) { @@ -357,64 +341,12 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF sprintf( VObjectDesc.ImageFile, "FACES\\SnowCamo\\%02d.sti", iFaceFileID ); } - if (!FileExists(VObjectDesc.ImageFile)) - sprintf( VObjectDesc.ImageFile, "FACES\\%02d.sti", iFaceFileID ); - } - else if( iFaceFileID > 99 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); - - if ( gCamoFace[usMercProfileID].gCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\Woodcamo\\%03d.sti", iFaceFileID ); - } - else if ( gCamoFace[usMercProfileID].gUrbanCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\UrbanCamo\\%03d.sti", iFaceFileID ); - } - else if ( gCamoFace[usMercProfileID].gDesertCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\DesertCamo\\%03d.sti", iFaceFileID ); - } - else if ( gCamoFace[usMercProfileID].gSnowCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\SnowCamo\\%03d.sti", iFaceFileID ); - } - - if (!FileExists(VObjectDesc.ImageFile)) - sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); - } - - /* - if( iFaceFileID < 100 ) - { - // The filename is the profile ID! + if (!FileExists(VObjectDesc.ImageFile)) sprintf( VObjectDesc.ImageFile, "FACES\\%02d.sti", iFaceFileID ); - - if ( gCamoFace[usMercProfileID].gCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\WoodCamo\\%02d.sti", iFaceFileID ); - } - else if ( gCamoFace[usMercProfileID].gUrbanCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\UrbanCamo\\%02d.sti", iFaceFileID ); - } - else if ( gCamoFace[usMercProfileID].gDesertCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\DesertCamo\\%02d.sti", iFaceFileID ); - } - else if ( gCamoFace[usMercProfileID].gSnowCamoface == TRUE ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\SnowCamo\\%02d.sti", iFaceFileID ); - } - - if (!FileExists(VObjectDesc.ImageFile)) - sprintf( VObjectDesc.ImageFile, "FACES\\%02d.sti", iFaceFileID ); } - else + else if( iFaceFileID > 99 ) { - - sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); + sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); if ( gCamoFace[usMercProfileID].gCamoface == TRUE ) { @@ -433,43 +365,28 @@ INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitF sprintf( VObjectDesc.ImageFile, "FACES\\SnowCamo\\%03d.sti", iFaceFileID ); } - if (!FileExists(VObjectDesc.ImageFile)) - sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); - + if (!FileExists(VObjectDesc.ImageFile)) + sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); } - */ } else if (gGameExternalOptions.fShowCamouflageFaces == FALSE ) { - - if ( ( iFaceFileID < 100 ) && ( gProfilesIMP[ usMercProfileID ].ProfilId == usMercProfileID ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFACES\\%02d.sti", iFaceFileID ); - } - else if ( ( iFaceFileID > 99 ) && ( gProfilesIMP[ usMercProfileID ].ProfilId == usMercProfileID ) ) - { - sprintf( VObjectDesc.ImageFile, "IMPFACES\\%03d.sti", iFaceFileID ); - } - else if( iFaceFileID < 100 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\%02d.sti", iFaceFileID ); - } - else if( iFaceFileID > 99 ) - { - sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); - } - - /* - if( iFaceFileID < 100 ) + if ( ( iFaceFileID < 100 ) && ( gMercProfiles[usMercProfileID].Type == PROFILETYPE_IMP ) ) { - // The filename is the profile ID! + sprintf( VObjectDesc.ImageFile, "IMPFACES\\%02d.sti", iFaceFileID ); + } + else if ( ( iFaceFileID > 99 ) && ( gMercProfiles[usMercProfileID].Type == PROFILETYPE_IMP ) ) + { + sprintf( VObjectDesc.ImageFile, "IMPFACES\\%03d.sti", iFaceFileID ); + } + else if( iFaceFileID < 100 ) + { sprintf( VObjectDesc.ImageFile, "FACES\\%02d.sti", iFaceFileID ); } - else + else if( iFaceFileID > 99 ) { sprintf( VObjectDesc.ImageFile, "FACES\\%03d.sti", iFaceFileID ); } - */ } } @@ -1847,7 +1764,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE BOOLEAN isIMP = FALSE; //IMP - if ( gProfilesIMP[ MercPtrs[ pFace->ubSoldierID ]->ubProfile ].ProfilId == MercPtrs[ pFace->ubSoldierID ]->ubProfile ) + if ( gMercProfiles[MercPtrs[pFace->ubSoldierID]->ubProfile].Type == PROFILETYPE_IMP ) { isIMP = TRUE; } diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 6ccc74c7..9cb1ce4f 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -4767,14 +4767,14 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) // Switch on target... // Are we a player dude.. ( target? ) - // if ( ubProfile < FIRST_RPC || RPC_RECRUITED( pTSoldier ) || ubProfile >= GASTON ) - //new profiles by Jazz - if ( ( gProfilesAIM[ubProfile].ProfilId == ubProfile || gProfilesMERC[ubProfile].ProfilId == ubProfile || gProfilesIMP[ubProfile].ProfilId == ubProfile ) || RPC_RECRUITED( pTSoldier ) ) + if ( gMercProfiles[ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[ubProfile].Type == PROFILETYPE_IMP || + RPC_RECRUITED( pTSoldier ) ) { fToTargetPlayer = TRUE; } - if ( fToTargetPlayer ) { // begin giving diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 8f0ec301..b1b59ed0 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -6149,15 +6149,14 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer } } -// if ( pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < GASTON && !RPC_RECRUITED( pSoldier ) && !AM_AN_EPC( pSoldier ) ) - //new profiles by Jazz - if ( pSoldier->ubProfile != NO_PROFILE && ( gProfilesRPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesNPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile ) && !RPC_RECRUITED( pSoldier ) && !AM_AN_EPC( pSoldier ) ) + if ( pSoldier->ubProfile != NO_PROFILE && ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_NPC ) && !RPC_RECRUITED( pSoldier ) && !AM_AN_EPC( pSoldier ) ) { fValidGuy = TRUE; } // Check for EPC... - if ( pSoldier->ubProfile != NO_PROFILE && ( gCurrentUIMode == TALKCURSOR_MODE || fGive ) && AM_AN_EPC( pSoldier ) ) + if ( pSoldier->ubProfile != NO_PROFILE && ( gCurrentUIMode == TALKCURSOR_MODE || fGive ) && AM_AN_EPC( pSoldier ) ) { fValidGuy = TRUE; } diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 089fdaaf..d2f809c3 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -9256,9 +9256,10 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) EndItemPointer( ); // If we are giving it to somebody not on our team.... - //if ( MercPtrs[ ubSoldierID ]->ubProfile < FIRST_RPC || MercPtrs[ubSoldierID]->ubProfile >= GASTON || RPC_RECRUITED( MercPtrs[ ubSoldierID ] ) ) - //new profiles by Jazz - if ( gProfilesIMP[MercPtrs[ ubSoldierID ]->ubProfile].ProfilId == MercPtrs[ ubSoldierID ]->ubProfile || gProfilesAIM[MercPtrs[ ubSoldierID ]->ubProfile].ProfilId == MercPtrs[ ubSoldierID ]->ubProfile || gProfilesMERC[MercPtrs[ ubSoldierID ]->ubProfile].ProfilId == MercPtrs[ ubSoldierID ]->ubProfile || RPC_RECRUITED( MercPtrs[ ubSoldierID ] ) ) + if ( gMercProfiles[MercPtrs[ubSoldierID]->ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[MercPtrs[ubSoldierID]->ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[MercPtrs[ubSoldierID]->ubProfile].Type == PROFILETYPE_IMP + || RPC_RECRUITED( MercPtrs[ubSoldierID] ) ) { } diff --git a/Tactical/Interface Utils.cpp b/Tactical/Interface Utils.cpp index 2bcd9910..315a693c 100644 --- a/Tactical/Interface Utils.cpp +++ b/Tactical/Interface Utils.cpp @@ -71,24 +71,16 @@ STR pbCarPortraitFileNames[ ]={ "INTERFACE\\Jeep.sti", }; - // load int he portraits for the car faces that will be use in mapscreen BOOLEAN LoadCarPortraitValues( void ) { VOBJECT_DESC VObjectDesc; - /* - if( giCarPortraits[ 0 ] != -1 ) - { - return FALSE; - } - */ - for ( INT32 iCounter = 0; iCounter < NUM_PROFILES; ++iCounter ) { // silversurfer: fixed to make sure that we only create objects for vehicles that have a face defined // otherwise CHECKF will fail and return FALSE breaking the for loop and ignoring any further vehicles - if ( gProfilesVehicle[ iCounter ].ProfilId == iCounter && gNewVehicle[ iCounter ].szIconFace[0] != 0 ) + if ( gMercProfiles[iCounter].Type == PROFILETYPE_VEHICLE && gNewVehicle[ iCounter ].szIconFace[0] != 0 ) { VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; strcpy( VObjectDesc.ImageFile, gNewVehicle[ iCounter ].szIconFace ); @@ -96,44 +88,21 @@ BOOLEAN LoadCarPortraitValues( void ) } } - /* - for( iCounter = 0; iCounter < NUMBER_CAR_PORTRAITS; iCounter++ ) - { - VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; - sprintf( VObjectDesc.ImageFile, pbCarPortraitFileNames[ iCounter ] ); - CHECKF( AddVideoObject( &VObjectDesc, (UINT32 *)&giCarPortraits[ iCounter ] ) ); - }*/ return( TRUE ); } // get rid of the images we loaded for the mapscreen car portraits void UnLoadCarPortraits( void ) { - // car protraits loaded? - /* - if( giCarPortraits[ 0 ] == -1 ) - { - return; - } - - for( iCounter = 0; iCounter < NUMBER_CAR_PORTRAITS; iCounter++ ) - { - DeleteVideoObjectFromIndex( giCarPortraits[ iCounter ] ); - giCarPortraits[ iCounter ] = -1; - } - */ - for ( INT32 iCounter = 0; iCounter < NUM_PROFILES; ++iCounter ) { - if ( gProfilesVehicle[ iCounter ].ProfilId == iCounter ) + if ( gMercProfiles[iCounter].Type == PROFILETYPE_VEHICLE ) { DeleteVideoObjectFromIndex( giCarPortraits[ iCounter ] ); } } } - - void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer ) { FLOAT dStart, dEnd, dPercentage; diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index c47061ae..cccc3b39 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -2042,9 +2042,10 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) mprintf( sX, sY, NameStr ); } -// if ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON || RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) - //new profiles by Jazz - if ( gProfilesIMP[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesAIM[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesMERC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )) + if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_IMP + || RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { if ( gGameExternalOptions.ubShowHealthBarsOnHead ) { diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index ee23a96a..93cbed13 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -182,26 +182,22 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) #ifdef JA2UB //JA25 UB //MErc mercs come with an umbrella - if ( gProfilesMERC[ubCurrentSoldier].ProfilId == ubCurrentSoldier ) -// if( ( ubCurrentSoldier >= 40 && ubCurrentSoldier <= 50 ) || ubCurrentSoldier == 58 /*GASTON*/ || ubCurrentSoldier == 59 /*STOGIE*/ ) + if ( gMercProfiles[ubCurrentSoldier].Type == PROFILETYPE_MERC ) { AddItemToMerc( iNewIndex, MERC_UMBRELLA ); //Data-1.13\TableData\Items\items.xml, uiIndex = 1361 or Data\TableData\Items\items.xml, uiIndex = 336 } - + //if this is an AIM or MERC merc if( gJa25SaveStruct.fHaveAimandMercOffferItems ) { //if its an aim merc - //if( ubCurrentSoldier < 40 ) - if ( gProfilesAIM[ubCurrentSoldier].ProfilId == ubCurrentSoldier ) + if ( gMercProfiles[ubCurrentSoldier].Type == PROFILETYPE_AIM ) { //give the mercs one of the promo items AddItemToMerc( iNewIndex, SAM_GARVER_COMBAT_KNIFE ); //1353 } - // if its a merc merc - else if ( gProfilesMERC[ubCurrentSoldier].ProfilId == ubCurrentSoldier ) - //else if( ubCurrentSoldier <= 50 || ubCurrentSoldier == 58 /*GASTON*/ || ubCurrentSoldier == 59 /*STOGIE*/ ) + else if ( gMercProfiles[ubCurrentSoldier].Type == PROFILETYPE_MERC ) { //give the mercs one of the promo items AddItemToMerc( iNewIndex, CHE_GUEVARA_CANTEEN ); //1359 @@ -338,28 +334,24 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) if (!is_client) { - //if we are trying to hire a merc that should arrive later, put the merc in the queue - if( pHireMerc->uiTimeTillMercArrives != 0 ) - { - AddStrategicEvent( EVENT_DELAYED_HIRING_OF_MERC, pHireMerc->uiTimeTillMercArrives, pSoldier->ubID ); + //if we are trying to hire a merc that should arrive later, put the merc in the queue + if( pHireMerc->uiTimeTillMercArrives != 0 ) + { + AddStrategicEvent( EVENT_DELAYED_HIRING_OF_MERC, pHireMerc->uiTimeTillMercArrives, pSoldier->ubID ); - //specify that the merc is hired but hasnt arrived yet - pMerc->bMercStatus = MERC_HIRED_BUT_NOT_ARRIVED_YET; - - } + //specify that the merc is hired but hasnt arrived yet + pMerc->bMercStatus = MERC_HIRED_BUT_NOT_ARRIVED_YET; + } } else { - if(is_client)send_hire( iNewIndex, ubCurrentSoldier, pHireMerc->iTotalContractLength, MercCreateStruct.fCopyProfileItemsOver ); - //send off hire info to network, also avail possibility for net-game exclusive hired pSoldier changes... + if(is_client)send_hire( iNewIndex, ubCurrentSoldier, pHireMerc->iTotalContractLength, MercCreateStruct.fCopyProfileItemsOver ); + //send off hire info to network, also avail possibility for net-game exclusive hired pSoldier changes... } - //if the merc is an AIM merc - //if( ubCurrentSoldier < 40 ) - if ( gProfilesAIM[ ubCurrentSoldier ].ProfilId == ubCurrentSoldier ) //new profiles by Jazz + if ( gMercProfiles[ubCurrentSoldier].Type == PROFILETYPE_AIM ) { - pSoldier->ubWhatKindOfMercAmI = MERC_TYPE__AIM_MERC; //determine how much the contract is, and remember what type of contract he got if( pHireMerc->iTotalContractLength == 1 ) @@ -386,8 +378,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) pSoldier->usMedicalDeposit = gMercProfiles[ pSoldier->ubProfile ].sMedicalDepositAmount; } //if the merc is from M.E.R.C. - //else if( ( ubCurrentSoldier >= BIFF && ubCurrentSoldier <= BUBBA ) || ubCurrentSoldier >= GASTON ) - else if ( gProfilesMERC[ ubCurrentSoldier ].ProfilId == ubCurrentSoldier ) //new profiles by Jazz + else if ( gMercProfiles[ubCurrentSoldier].Type == PROFILETYPE_MERC ) { pSoldier->ubWhatKindOfMercAmI = MERC_TYPE__MERC; //pSoldier->iTotalContractCharge = -1; @@ -400,8 +391,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) if(!is_client)AddHistoryToPlayersLog(HISTORY_HIRED_MERC_FROM_MERC, ubCurrentSoldier, GetWorldTotalMin(), -1, -1 ); } //If the merc is from IMP, (ie a player character) - //else if( ( ubCurrentSoldier >= 51 ) && ( ubCurrentSoldier < 57 ) ) - else if ( gProfilesIMP[ ubCurrentSoldier ].ProfilId == ubCurrentSoldier ) //new profiles by Jazz + else if ( gMercProfiles[ubCurrentSoldier].Type == PROFILETYPE_IMP ) { pSoldier->ubWhatKindOfMercAmI = MERC_TYPE__PLAYER_CHARACTER; //pSoldier->iTotalContractCharge = -1; @@ -423,6 +413,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) CheckForFriendsofHated( pSoldier ); gfAtLeastOneMercWasHired = TRUE; + return( MERC_HIRE_OK ); } diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 1bbbf75d..218792eb 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -904,7 +904,7 @@ BOOLEAN EnterShopKeeperInterface() gubArrayOfEmployedMercs[ gubNumberMercsInArray ] = pSoldier->ubProfile; //Create the string for the face file name - if ( gProfilesIMP[ pSoldier->ubProfile ].ProfilId == pSoldier->ubProfile ) + if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { sprintf( zTemp, "IMPFACES\\33FACE\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex ); } diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 28a3611d..68d90b77 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -1659,9 +1659,9 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) SoldierGiveItemFromAnimation( pSoldier ); // 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)) + if (pSoldier->ubProfile != NO_PROFILE && ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_NPC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_VEHICLE ) ) { TriggerNPCWithGivenApproach( pSoldier->ubProfile, APPROACH_DONE_GIVING_ITEM, FALSE ); } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index e4a6191e..b5c13fc4 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1550,6 +1550,7 @@ void MERCPROFILESTRUCT::initialize( ) memset( &sDynamicOpinionLongTerm, 0, sizeof(sDynamicOpinionLongTerm) ); memset( &usVoiceIndex, 0, sizeof(UINT32) ); + memset( &Type, 0, sizeof( UINT32 ) ); } // Initialize the soldier. @@ -10542,10 +10543,9 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr } } } - - // if ((ubAttacker != NOBODY) && (Menptr[ubAttacker].bTeam == OUR_TEAM) && (this->ubProfile != NO_PROFILE) && (this->ubProfile >= FIRST_RPC && this->ubProfile < GASTON )) - //new profiles by Jazz - if ( (ubAttacker != NOBODY) && (Menptr[ubAttacker].bTeam == OUR_TEAM) && (this->ubProfile != NO_PROFILE) && gProfilesRPC[this->ubProfile].ProfilId == this->ubProfile || gProfilesNPC[this->ubProfile].ProfilId == this->ubProfile ) + + if ( (ubAttacker != NOBODY) && (Menptr[ubAttacker].bTeam == OUR_TEAM) && (this->ubProfile != NO_PROFILE) && gMercProfiles[this->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[this->ubProfile].Type == PROFILETYPE_NPC ) { gMercProfiles[this->ubProfile].ubMiscFlags |= PROFILE_MISC_FLAG_WOUNDEDBYPLAYER; if ( this->ubProfile == 114 ) @@ -12955,9 +12955,8 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection ) // OK, check if we should play quote... if ( pTSoldier->bTeam != gbPlayerNum ) { - // if ( pTSoldier->ubProfile != NO_PROFILE && pTSoldier->ubProfile >= FIRST_RPC && pTSoldier->ubProfile < GASTON && !RPC_RECRUITED( pTSoldier ) ) - //new profiles by Jazz - if ( pTSoldier->ubProfile != NO_PROFILE && (gProfilesRPC[pTSoldier->ubProfile].ProfilId == pTSoldier->ubProfile || gProfilesNPC[pTSoldier->ubProfile].ProfilId == pTSoldier->ubProfile) && !RPC_RECRUITED( pTSoldier ) ) + if ( pTSoldier->ubProfile != NO_PROFILE && !RPC_RECRUITED( pTSoldier ) && ( gMercProfiles[pTSoldier->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[pTSoldier->ubProfile].Type == PROFILETYPE_NPC ) ) { fRefused = PCDoesFirstAidOnNPC( pTSoldier->ubProfile ); } diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 97e020b0..c9bec31b 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -2595,12 +2595,11 @@ void AddProfilesUsingProfileInsertionData() //for( i = FIRST_RPC; i < ( PROF_HUMMER ); i++ ) //new profiles by Jazz - for( i = 0; i < NUM_PROFILES; i++ ) + for( i = 0; i < NUM_PROFILES; ++i ) { - - if ( gProfilesRPC[i].ProfilId == i || gProfilesNPC[i].ProfilId == i ) - { - + if ( gMercProfiles[i].Type == PROFILETYPE_RPC || + gMercProfiles[i].Type == PROFILETYPE_NPC ) + { //Perform various checks to make sure the soldier is actually in the same sector, alive, and so on. //More importantly, the flag to use profile insertion data must be set. if( gMercProfiles[ i ].sSectorX != gWorldSectorX || diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index eb98b7b4..e107dbdd 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -81,14 +81,8 @@ class OBJECTTYPE; class SOLDIERTYPE; -//new profiles by Jazz------------------------------- -AIM_PROFIL gProfilesAIM[ NUM_PROFILES ]; -MERC_PROFIL gProfilesMERC[ NUM_PROFILES ]; -NPC_PROFIL gProfilesNPC[ NUM_PROFILES ]; -RPC_PROFIL gProfilesRPC[ NUM_PROFILES ]; -VEHICLE_PROFIL gProfilesVehicle[ NUM_PROFILES ]; -IMP_PROFIL gProfilesIMP[NUM_PROFILES]; -//--------------------------------------------------- +// Flugente: why do we require 6 different structures and arrays if all we keep track of is the profile type? A simple array is enough +UINT8 gProfileType[NUM_PROFILES]; BOOLEAN gfPotentialTeamChangeDuringDeath = FALSE; @@ -260,185 +254,36 @@ void DecideActiveTerrorists( void ); extern SOLDIERTYPE *gpSMCurrentMerc; extern BOOLEAN gfRerenderInterfaceFromHelpText; -BOOLEAN SaveNewSystemMercsToSaveGameFile( HWFILE hFile ); -BOOLEAN LoadNewSystemMercsToSaveGameFile( HWFILE hFile ); -void InitNewProfiles(); - - -// WANNE: This method is not needed anymore. All the stuff is done in the LoadMercProfiles() method. -void InitNewProfiles() -{ - UINT32 uiProfileId = 0; - - UINT32 i = 0; - - UINT32 uiLoop; - - //new profiles by Jazz - for( uiProfileId = 0; uiProfileId < NUM_PROFILES; uiProfileId++ ) - { - gProfilesAIM[ uiProfileId ].ProfilId = -1; - gProfilesMERC[ uiProfileId ].ProfilId = -1; - gProfilesNPC[ uiProfileId ].ProfilId = -1; - gProfilesRPC[ uiProfileId ].ProfilId = -1; - gProfilesVehicle[ uiProfileId ].ProfilId = -1; - gProfilesIMP[ uiProfileId ].ProfilId = -1; - } - - for( uiProfileId = 0; uiProfileId < 40; uiProfileId++ ) - { - gProfilesAIM[ uiProfileId ].ProfilId = uiProfileId; - } - - for( uiProfileId = 40; uiProfileId < 51; uiProfileId++ ) - { - gProfilesMERC[ uiProfileId ].ProfilId = uiProfileId; - } - - for( uiProfileId = FIRST_RPC; uiProfileId < FIRST_NPC; uiProfileId++ ) - { - gProfilesRPC[ uiProfileId ].ProfilId = uiProfileId; - } - - for( uiProfileId = FIRST_NPC; uiProfileId < 160; uiProfileId++ ) - { - gProfilesNPC[ uiProfileId ].ProfilId = uiProfileId; - } - - //IMP - gProfilesIMP[ 51 ].ProfilId = 51; //IMP Male - gProfilesIMP[ 52 ].ProfilId = 52; //IMP Male - gProfilesIMP[ 53 ].ProfilId = 53; //IMP Male - gProfilesIMP[ 54 ].ProfilId = 54; //IMP Female - gProfilesIMP[ 55 ].ProfilId = 55; //IMP Female - gProfilesIMP[ 56 ].ProfilId = 56; //IMP Female - - //Vehicle - gProfilesVehicle[ 160 ].ProfilId = 160; //Hummer - gProfilesVehicle[ 161 ].ProfilId = 161; //El Dorado - gProfilesVehicle[ 162 ].ProfilId = 162; //Truck - gProfilesVehicle[ 163 ].ProfilId = 163; //HELICOPTER - gProfilesVehicle[ 164 ].ProfilId = 164; //TANK_CAR - - //NPC - gProfilesNPC[ 169 ].ProfilId = 169; //none - - //MERC - gProfilesMERC[ 165 ].ProfilId = 165; //Gaston - gProfilesMERC[ 166 ].ProfilId = 166; //Stogie - gProfilesMERC[ 167 ].ProfilId = 167; //Tex - gProfilesMERC[ 168 ].ProfilId = 168; //Beggins - - for(uiLoop=0; uiLoop < 40; uiLoop++) - { - if ( gProfilesAIM[uiLoop].ProfilId == uiLoop ) - { - AimMercArray[ i ] = uiLoop; - } - i++; - } - - MAX_NUMBER_MERCS = 40; - START_MERC = 0; - - if ( gGameExternalOptions.fReadProfileDataFromXML == TRUE ) - { - for( uiProfileId = 0; uiProfileId < NUM_PROFILES; uiProfileId++ ) - { - gProfilesAIM[ uiProfileId ].ProfilId = -1; - gProfilesMERC[ uiProfileId ].ProfilId = -1; - gProfilesNPC[ uiProfileId ].ProfilId = -1; - gProfilesRPC[ uiProfileId ].ProfilId = -1; - gProfilesVehicle[ uiProfileId ].ProfilId = -1; - gProfilesIMP[ uiProfileId ].ProfilId = -1; - } - } - - //------------------------------------------------------------------------ -} - -BOOLEAN SaveNewSystemMercsToSaveGameFile( HWFILE hFile ) -{ - UINT32 uiNumBytesWritten; - - FileWrite( hFile, &gProfilesAIM, sizeof( gProfilesAIM), &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( gProfilesAIM ) ) - { - return( FALSE ); - } - - FileWrite( hFile, &gProfilesMERC, sizeof( gProfilesMERC), &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( gProfilesMERC ) ) - { - return( FALSE ); - } - - FileWrite( hFile, &gProfilesNPC, sizeof( gProfilesNPC), &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( gProfilesNPC ) ) - { - return( FALSE ); - } - - FileWrite( hFile, &gProfilesRPC, sizeof( gProfilesRPC), &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( gProfilesRPC ) ) - { - return( FALSE ); - } - - FileWrite( hFile, &gProfilesVehicle, sizeof( gProfilesVehicle), &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( gProfilesVehicle ) ) - { - return( FALSE ); - } - - FileWrite( hFile, &gProfilesIMP, sizeof( gProfilesIMP), &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( gProfilesIMP ) ) - { - return( FALSE ); - } - return( TRUE ); -} - BOOLEAN LoadNewSystemMercsToSaveGameFile( HWFILE hFile ) { + // read the old data from the save file and store it in the new array while you're at it UINT32 uiNumBytesRead; - FileRead( hFile, &gProfilesAIM, sizeof( gProfilesAIM), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( gProfilesAIM ) ) - { - return( FALSE ); - } - - FileRead( hFile, &gProfilesMERC, sizeof( gProfilesMERC), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( gProfilesMERC ) ) - { - return( FALSE ); - } - - FileRead( hFile, &gProfilesNPC, sizeof( gProfilesNPC), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( gProfilesNPC ) ) - { - return( FALSE ); - } - - FileRead( hFile, &gProfilesRPC, sizeof( gProfilesRPC), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( gProfilesRPC ) ) - { - return( FALSE ); - } - - FileRead( hFile, &gProfilesVehicle, sizeof( gProfilesVehicle), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( gProfilesVehicle ) ) - { - return( FALSE ); - } - - FileRead( hFile, &gProfilesIMP, sizeof( gProfilesIMP), &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( gProfilesIMP ) ) - { - return( FALSE ); - } + for ( int i = 0; i < NUM_PROFILES; ++i ) + gProfileType[i] = PROFILETYPE_NONE; + typedef struct + { + UINT8 ProfilId; + } TMP_PROFIL; + + TMP_PROFIL tmpprofilewedontreallyneed[NUM_PROFILES]; + + for ( int profiletype = PROFILETYPE_AIM; profiletype < PROFILETYPE_MAX; ++profiletype ) + { + FileRead( hFile, &tmpprofilewedontreallyneed, sizeof( tmpprofilewedontreallyneed ), &uiNumBytesRead ); + if ( uiNumBytesRead != sizeof( tmpprofilewedontreallyneed ) ) + { + return( FALSE ); + } + + for ( int i = 0; i < NUM_PROFILES; ++i ) + { + if ( tmpprofilewedontreallyneed[i].ProfilId == i ) + gProfileType[i] = profiletype; + } + } + return( TRUE ); } @@ -711,12 +556,7 @@ BOOLEAN LoadMercProfiles(void) UINT32 uiLoop, uiLoop2;//, uiLoop3; UINT16 usItem;//, usNewGun, usAmmo, usNewAmmo; - - // ----- WANNE.PROFILE: New Profile Loading - BEGIN - //InitNewProfiles(); - // ----- WANNE.PROFILE: New Profile Loading - END - - + if (gGameExternalOptions.fUseDifficultyBasedProfDat == TRUE) { switch ( gGameOptions.ubDifficultyLevel) @@ -764,8 +604,7 @@ BOOLEAN LoadMercProfiles(void) #endif } - - + if( !fptr ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to LoadMercProfiles from file %s", pFileName) ); @@ -773,21 +612,16 @@ BOOLEAN LoadMercProfiles(void) } // Reset - for( int uiProfileId = 0; uiProfileId < NUM_PROFILES; uiProfileId++ ) - { - gProfilesAIM[ uiProfileId ].ProfilId = -1; - gProfilesMERC[ uiProfileId ].ProfilId = -1; - gProfilesNPC[ uiProfileId ].ProfilId = -1; - gProfilesRPC[ uiProfileId ].ProfilId = -1; - gProfilesVehicle[ uiProfileId ].ProfilId = -1; - gProfilesIMP[ uiProfileId ].ProfilId = -1; + for( int uiProfileId = 0; uiProfileId < NUM_PROFILES; ++uiProfileId ) + { + gProfileType[uiProfileId] = PROFILETYPE_NONE; } int profileIndex = -1; - for(uiLoop=0; uiLoop< NUM_PROFILES; uiLoop++) + for(uiLoop=0; uiLoop< NUM_PROFILES; ++uiLoop) { - profileIndex++; + ++profileIndex; // Changed by ADB, rev 1513 //if( !gMercProfiles[uiLoop].Load(fptr, true)) @@ -816,6 +650,7 @@ BOOLEAN LoadMercProfiles(void) gMercProfiles[uiLoop].iMercMercContractLength = 0; gMercProfiles[uiLoop].usBackground = 0; + gMercProfiles[uiLoop].Type = PROFILETYPE_NONE; memset( &gMercProfiles[uiLoop].usDynamicOpinionFlagmask, 0, sizeof(gMercProfiles[uiLoop].usDynamicOpinionFlagmask) ); @@ -1010,25 +845,25 @@ BOOLEAN LoadMercProfiles(void) gMercProfiles[ uiLoop ].usApproachFactor[3] = 100; } } - + // AIM und MERC ( 0 - 51 ) if (uiLoop < 51) { // AIM if (uiLoop < 40) { - gProfilesAIM[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_AIM; } // MERC else { - gProfilesMERC[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_MERC; } } // IMP (51 - 56) else if (uiLoop >= 51 && uiLoop < FIRST_RPC) { - gProfilesIMP[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_IMP; } else { @@ -1041,7 +876,7 @@ BOOLEAN LoadMercProfiles(void) case REGMALE: case BIGMALE: case REGFEMALE: - gProfilesMERC[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_MERC; break; // Vehicle case HUMVEE: @@ -1051,11 +886,11 @@ BOOLEAN LoadMercProfiles(void) case ICECREAMTRUCK: case JEEP: case COMBAT_JEEP: - gProfilesVehicle[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_VEHICLE; break; // Make it an RPC default: - gProfilesRPC[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_RPC; break; } } @@ -1064,7 +899,7 @@ BOOLEAN LoadMercProfiles(void) // Last Index -> NPC if (uiLoop == 169) { - gProfilesNPC[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_NPC; } // NPC, RPC or Vehicle else @@ -1079,19 +914,19 @@ BOOLEAN LoadMercProfiles(void) case ICECREAMTRUCK: case JEEP: case COMBAT_JEEP: - gProfilesVehicle[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_VEHICLE; break; // RPC or NPC default: // RPC if (uiLoop >= FIRST_RPC && uiLoop < FIRST_NPC) { - gProfilesRPC[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_RPC; } // NPC else { - gProfilesNPC[uiLoop].ProfilId = uiLoop; + gProfileType[uiLoop] = PROFILETYPE_NPC; } break; } @@ -1553,21 +1388,14 @@ void MakeRemainingAssassinsTougher( void ) void StartSomeMercsOnAssignment(void) { - UINT32 uiCnt; MERCPROFILESTRUCT *pProfile; UINT32 uiChance; // some randomly picked A.I.M. mercs will start off "on assignment" at the beginning of each new game - for( uiCnt = 0; uiCnt < NUM_PROFILES; uiCnt++) // AIM_AND_MERC_MERCS + for( UINT32 uiCnt = 0; uiCnt < NUM_PROFILES; ++uiCnt) // AIM_AND_MERC_MERCS { - //new profiles by Jazz - if ( gProfilesAIM[ uiCnt ].ProfilId == (UINT8)uiCnt || gProfilesMERC[ uiCnt ].ProfilId == (UINT8)uiCnt ) + if ( IsProfileIdAnAimOrMERCMerc( (UINT8)uiCnt ) ) { - if( !IsProfileIdAnAimOrMERCMerc( (UINT8)uiCnt ) ) - { - continue; - } - pProfile = &(gMercProfiles[ uiCnt ]); #ifdef JA2UB //Make sure stigie and Gaston are available at the start of the game @@ -2234,12 +2062,11 @@ BOOLEAN IsProfileAHeadMiner( UINT8 ubProfile ) void UpdateSoldierPointerDataIntoProfile( BOOLEAN fPlayerMercs ) { - UINT32 uiCount; SOLDIERTYPE *pSoldier = NULL; MERCPROFILESTRUCT * pProfile; BOOLEAN fDoCopy = FALSE; - for( uiCount=0; uiCount < guiNumMercSlots; uiCount++) + for( UINT32 uiCount=0; uiCount < guiNumMercSlots; ++uiCount) { pSoldier = MercSlots[ uiCount ]; @@ -2252,18 +2079,18 @@ void UpdateSoldierPointerDataIntoProfile( BOOLEAN fPlayerMercs ) // If we are above player mercs if ( fPlayerMercs ) { - //if ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON ) - //new profiles by Jazz - if ( gProfilesIMP[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesAIM[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesMERC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile) + if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { fDoCopy = TRUE; } } else { - //if ( pSoldier->ubProfile >= FIRST_RPC && pSoldier->ubProfile < GASTON ) - //new profiles by Jazz - if ( gProfilesRPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesNPC[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile || gProfilesVehicle[pSoldier->ubProfile].ProfilId == pSoldier->ubProfile ) + if ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_NPC || + gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_VEHICLE ) { fDoCopy = TRUE; } @@ -2604,9 +2431,7 @@ BOOLEAN DoesNPCOwnBuilding( SOLDIERTYPE *pSoldier, INT32 sGridNo ) BOOLEAN IsProfileIdAnAimOrMERCMerc( UINT8 ubProfileID ) { - - //if( ubProfileID < BIFF || ( ubProfileID >= BIFF && ubProfileID <= BUBBA ) || ubProfileID >= GASTON ) - if( gProfilesAIM[ ubProfileID ].ProfilId == ubProfileID || gProfilesMERC[ ubProfileID ].ProfilId == ubProfileID ) + if ( gMercProfiles[ ubProfileID ].Type == PROFILETYPE_AIM || gMercProfiles[ubProfileID].Type == PROFILETYPE_MERC ) { return( TRUE ); } @@ -2801,82 +2626,35 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop ) gMercProfiles[ uiLoop ].bTownAttachment = tempProfiles[uiLoop].bTownAttachment; gMercProfiles[ uiLoop ].usBackground = tempProfiles[uiLoop].usBackground; gMercProfiles[ uiLoop ].usVoiceIndex = tempProfiles[uiLoop].usVoiceIndex; - - //None - if ( tempProfiles[uiLoop].Type == 0 ) - { - //Reset - gMercProfiles[ uiLoop ].sSectorX = 0; - gMercProfiles[ uiLoop ].sSectorY = 0; - gMercProfiles[ uiLoop ].bSectorZ = 0; - gMercProfiles[ uiLoop ].bTown = 0; - gMercProfiles[ uiLoop ].bTownAttachment = 0; - } - - //AIM - if ( tempProfiles[uiLoop].Type == 1 ) - { - gProfilesAIM[ uiLoop ].ProfilId = uiLoop; - - //Reset - gMercProfiles[ uiLoop ].sSectorX = 0; - gMercProfiles[ uiLoop ].sSectorY = 0; - gMercProfiles[ uiLoop ].bSectorZ = 0; - gMercProfiles[ uiLoop ].bTown = 0; - gMercProfiles[ uiLoop ].bTownAttachment = 0; - } - - //MERC - if ( tempProfiles[uiLoop].Type == 2 ) - { - gProfilesMERC[ uiLoop ].ProfilId = uiLoop; - - //Reset - gMercProfiles[ uiLoop ].sSectorX = 0; - gMercProfiles[ uiLoop ].sSectorY = 0; - gMercProfiles[ uiLoop ].bSectorZ = 0; - gMercProfiles[ uiLoop ].bTown = 0; - gMercProfiles[ uiLoop ].bTownAttachment = 0; - } - - //RPC - if ( tempProfiles[uiLoop].Type == 3 ) - { - gProfilesRPC[ uiLoop ].ProfilId = uiLoop; - } - - //NPC - if ( tempProfiles[uiLoop].Type == 4 ) - { - gProfilesNPC[ uiLoop ].ProfilId = uiLoop; - } - - //Vehicle - if ( tempProfiles[uiLoop].Type == 5 ) - { - gProfilesVehicle[ uiLoop ].ProfilId = uiLoop; - } - - //IMP - if ( tempProfiles[uiLoop].Type == 6 ) - { - gProfilesIMP[ uiLoop ].ProfilId = uiLoop; - - //Reset - gMercProfiles[ uiLoop ].sSectorX = 0; - gMercProfiles[ uiLoop ].sSectorY = 0; - gMercProfiles[ uiLoop ].bSectorZ = 0; - gMercProfiles[ uiLoop ].bTown = 0; - gMercProfiles[ uiLoop ].bTownAttachment = 0; - } - + gMercProfiles[ uiLoop ].Type = tempProfiles[uiLoop].Type; + + gProfileType[uiLoop] = gMercProfiles[uiLoop].Type; + + switch ( tempProfiles[uiLoop].Type ) + { + case PROFILETYPE_RPC: + case PROFILETYPE_NPC: + case PROFILETYPE_VEHICLE: + break; + + case PROFILETYPE_NONE: + case PROFILETYPE_AIM: + case PROFILETYPE_MERC: + case PROFILETYPE_IMP: + default: + //Reset + gMercProfiles[uiLoop].sSectorX = 0; + gMercProfiles[uiLoop].sSectorY = 0; + gMercProfiles[uiLoop].bSectorZ = 0; + gMercProfiles[uiLoop].bTown = 0; + gMercProfiles[uiLoop].bTownAttachment = 0; + break; + } } void OverwriteMercOpinionsWithXMLData( UINT32 uiLoop ) { - UINT8 cnt; - - for (cnt=0; cnt< NUMBER_OF_OPINIONS; ++cnt ) + for ( UINT8 cnt=0; cnt< NUMBER_OF_OPINIONS; ++cnt ) { gMercProfiles[ uiLoop ].bMercOpinion[cnt] = tempProfiles[ uiLoop ].bMercOpinion[cnt] ; } @@ -2892,14 +2670,10 @@ INT8 CheckMercsNearForCharTraits( UINT8 ubProfileID, INT8 bCharTraitID ) BOOLEAN fOnlyOneException = FALSE; pSoldier = FindSoldierByProfileID( ubProfileID, FALSE ); - if (!pSoldier) + if (!pSoldier || !( pSoldier->bActive ) || !( pSoldier->bInSector ) ) { return( -1 ); } - if( !(pSoldier->bActive) || !(pSoldier->bInSector) ) - { - return( -1 ); - } for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop < gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; uiLoop++) { diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index b50845d9..9eef6079 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -41,47 +41,24 @@ extern MERCPROFILEGEAR gMercProfileGear[ NUM_PROFILES ][ NUM_MERCSTARTINGGEAR_KI //use this to sort out the above define BOOLEAN IsProfileIdAnAimOrMERCMerc( UINT8 ubProfileID ); -//enums for the mercs -//new profiles by Jazz------------------------------- -typedef struct +//enums for the mercs +enum ProfileType { - UINT8 ProfilId; -} AIM_PROFIL; + PROFILETYPE_NONE = 0, + PROFILETYPE_AIM, + PROFILETYPE_MERC, + PROFILETYPE_RPC, + PROFILETYPE_NPC, + PROFILETYPE_VEHICLE, + PROFILETYPE_IMP, -typedef struct -{ - UINT8 ProfilId; -} MERC_PROFIL; + PROFILETYPE_MAX +}; -typedef struct -{ - UINT8 ProfilId; -} NPC_PROFIL; +// Flugente: why do we require 6 different structures and arrays if all we keep track of is the profile type? A simple array is enough (and only needed during loading anyway) +extern UINT8 gProfileType[NUM_PROFILES]; -typedef struct -{ - UINT8 ProfilId; -} RPC_PROFIL; - -typedef struct -{ - UINT8 ProfilId; -} VEHICLE_PROFIL; - -typedef struct -{ - UINT8 ProfilId; -} IMP_PROFIL; - -extern AIM_PROFIL gProfilesAIM[ NUM_PROFILES ]; -extern MERC_PROFIL gProfilesMERC[ NUM_PROFILES ]; -extern NPC_PROFIL gProfilesNPC[ NUM_PROFILES ]; -extern RPC_PROFIL gProfilesRPC[ NUM_PROFILES ]; -extern VEHICLE_PROFIL gProfilesVehicle[ NUM_PROFILES ]; -extern IMP_PROFIL gProfilesIMP[NUM_PROFILES]; - -extern BOOLEAN SaveNewSystemMercsToSaveGameFile( HWFILE hFile ); extern BOOLEAN LoadNewSystemMercsToSaveGameFile( HWFILE hFile ); //--------------------------------------------------- diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index 9a119245..0a3fb37c 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -1133,8 +1133,7 @@ BOOLEAN CopyVehiclePathToSoldier( SOLDIERTYPE *pSoldier ) return( FALSE ); } } - - + // reset mvt group for the grunt // ATE: NOT if we are the vehicle if ( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) @@ -1155,31 +1154,13 @@ BOOLEAN CopyVehiclePathToSoldier( SOLDIERTYPE *pSoldier ) pSoldier->pMercPath = CopyPaths(pVehicleList[ iId ].pMercPath, pSoldier->pMercPath ); return( TRUE ); - } BOOLEAN IsVehicle(SOLDIERTYPE *pSoldier) { - - if ( gProfilesVehicle[ pSoldier->ubProfile ].ProfilId == pSoldier->ubProfile ) - return(TRUE); - else - return(FALSE); - - /*switch(pSoldier->ubProfile) - { - case PROF_HUMMER: - case PROF_ELDERODO: - case PROF_ICECREAM: - return(TRUE); - default: - return(FALSE); - } - return(FALSE); - */ + return ( gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_VEHICLE ); } - BOOLEAN SetUpMvtGroupForVehicle( SOLDIERTYPE *pSoldier ) { // given this grunt, find out if asscoiated vehicle has a mvt group, if so, set this grunts mvt group tho the vehicle diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index 5123cfea..da975301 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -350,8 +350,6 @@ profileEndElementHandle(void *userData, const XML_Char *name) tempProfiles[pData->curIndex].bArmourAttractiveness = pData->curProfile.bArmourAttractiveness; tempProfiles[pData->curIndex].bMainGunAttractiveness = pData->curProfile.bMainGunAttractiveness; - tempProfiles[pData->curIndex].Type = pData->curProfile.Type; - tempProfiles[pData->curIndex].sSectorX = pData->curProfile.sSectorX; tempProfiles[pData->curIndex].sSectorY = pData->curProfile.sSectorY; tempProfiles[pData->curIndex].bSectorZ = pData->curProfile.bSectorZ; @@ -360,10 +358,10 @@ profileEndElementHandle(void *userData, const XML_Char *name) tempProfiles[pData->curIndex].bTownAttachment = pData->curProfile.bTownAttachment; tempProfiles[pData->curIndex].usBackground = pData->curProfile.usBackground; tempProfiles[pData->curIndex].usVoiceIndex = pData->curProfile.usVoiceIndex; + tempProfiles[pData->curIndex].Type = pData->curProfile.Type; tempProfiles[pData->curIndex].fGoodGuy = pData->curProfile.fGoodGuy; - memcpy( &(tempProfiles[pData->curIndex].usApproachFactor), &(pData->curProfile.usApproachFactor), 4 * sizeof (UINT16)); - + memcpy( &(tempProfiles[pData->curIndex].usApproachFactor), &(pData->curProfile.usApproachFactor), 4 * sizeof (UINT16)); } else { @@ -1245,43 +1243,6 @@ BOOLEAN WriteMercProfiles() FilePrintf(hFile,"\t\t%d\r\n", cnt); - if (cnt >= 0 && cnt < 40 ) - { - FilePrintf(hFile,"\t\t1\r\n"); - } - else if (cnt >= 40 && cnt < 51 ) - { - FilePrintf(hFile,"\t\t2\r\n"); - } - else if ( cnt >= FIRST_RPC && cnt < FIRST_NPC ) - { - FilePrintf(hFile,"\t\t3\r\n"); - } - else if ( cnt >= FIRST_NPC && cnt < 160 ) - { - FilePrintf(hFile,"\t\t4\r\n"); - } - else if ( cnt == 169 ) - { - FilePrintf(hFile,"\t\t4\r\n"); - } - else if ( cnt == 165 || cnt == 166 || cnt == 167 || cnt == 168 ) - { - FilePrintf(hFile,"\t\t2\r\n"); - } - else if ( cnt == 51 || cnt == 52 || cnt == 53 || cnt == 54 || cnt == 55 || cnt == 56 ) - { - FilePrintf(hFile,"\t\t6\r\n"); - } - else if ( cnt == 160 || cnt == 161 || cnt == 162 || cnt == 163 || cnt == 164 ) - { - FilePrintf(hFile,"\t\t5\r\n"); - } - else - { - FilePrintf(hFile,"\t\t0\r\n"); - } - ////////////////////////////// // Write Character Name @@ -1391,6 +1352,7 @@ BOOLEAN WriteMercProfiles() // FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].ubFaceIndex); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[cnt].Type ); FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[cnt].usVoiceIndex ); FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].usEyesX); FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].usEyesY); diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index cb89f333..fed634f2 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -4651,11 +4651,13 @@ void DebugSoldierPage3( ) SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); gprintf( 150, LINE_HEIGHT * ubLine, L"%d", pSoldier->flags.fRTInNonintAnim ); ubLine++; - + // OPIONION OF SELECTED MERC - //if ( gusSelectedSoldier != NOBODY && ( MercPtrs[ gusSelectedSoldier ]->ubProfile < FIRST_NPC ) && pSoldier->ubProfile != NO_PROFILE ) - //new profiles by Jazz - if ( gusSelectedSoldier != NOBODY && ( gProfilesIMP[MercPtrs[ gusSelectedSoldier ]->ubProfile].ProfilId == MercPtrs[ gusSelectedSoldier ]->ubProfile || gProfilesRPC[MercPtrs[ gusSelectedSoldier ]->ubProfile].ProfilId == MercPtrs[ gusSelectedSoldier ]->ubProfile || gProfilesAIM[MercPtrs[ gusSelectedSoldier ]->ubProfile].ProfilId == MercPtrs[ gusSelectedSoldier ]->ubProfile || gProfilesMERC[MercPtrs[ gusSelectedSoldier ]->ubProfile].ProfilId == MercPtrs[ gusSelectedSoldier ]->ubProfile ) && pSoldier->ubProfile != NO_PROFILE ) + if ( gusSelectedSoldier != NOBODY && pSoldier->ubProfile != NO_PROFILE && ( + gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_IMP ) ) { SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"NPC Opinion:"); @@ -4664,7 +4666,6 @@ void DebugSoldierPage3( ) gprintf( 150, LINE_HEIGHT * ubLine, L"%d", gMercProfiles[ pSoldier->ubProfile ].bMercOpinion[ MercPtrs[ gusSelectedSoldier ]->ubProfile ] ); ubLine++; } - } else if ( GetMouseMapPos( &usMapPos ) ) { diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 40d9e96d..671ef539 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -972,6 +972,9 @@ public: // Flugente: voice set used UINT32 usVoiceIndex; + + // Flugente: type of profile + UINT32 Type; }; // MERCPROFILESTRUCT; // WANNE - BMP: DONE! diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 4fb869a7..e890ed5c 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -184,10 +184,10 @@ NPCQuoteInfo * LoadQuoteFile( UINT8 ubNPC ) sprintf( zFileName, "NPCData\\%03d.npc", ubNPC ); } #endif - - //else if ( ubNPC < FIRST_RPC || ubNPC >= GASTON || (ubNPC < FIRST_NPC && gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) ) - //new profiles by Jazz - else if ( gProfilesIMP[ubNPC].ProfilId == ubNPC || gProfilesAIM[ubNPC].ProfilId == ubNPC || gProfilesMERC[ubNPC].ProfilId == ubNPC || ( gProfilesRPC[ubNPC].ProfilId == ubNPC && gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) ) + else if ( gMercProfiles[ubNPC].Type == PROFILETYPE_AIM || + gMercProfiles[ubNPC].Type == PROFILETYPE_MERC || + (gMercProfiles[ubNPC].Type == PROFILETYPE_RPC && gMercProfiles[ubNPC].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) || + gMercProfiles[ubNPC].Type == PROFILETYPE_IMP ) { sprintf( zFileName, "NPCData\\000.npc" ); } @@ -375,10 +375,7 @@ BOOLEAN EnsureQuoteFileLoaded( UINT8 ubNPC ) } } - -// if ( ubNPC >= FIRST_RPC && ubNPC < FIRST_NPC ) - //new profiles by Jazz - if ( ( gProfilesRPC[ubNPC].ProfilId == ubNPC ) ) + if ( gMercProfiles[ubNPC].Type == PROFILETYPE_RPC ) { if (gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED) { @@ -441,8 +438,7 @@ BOOLEAN EnsureQuoteFileLoaded( UINT8 ubNPC ) pNull->stats.bLife = 0; } } - - + #endif } @@ -483,39 +479,34 @@ BOOLEAN RefreshNPCScriptRecord( UINT8 ubNPC, UINT8 ubRecord ) { UINT8 ubLoop; NPCQuoteInfo * pNewArray; - + if ( ubNPC == NO_PROFILE ) { // we have some work to do... // loop through all PCs, and refresh their copy of this record //for ( ubLoop = 0; ubLoop < FIRST_RPC; ubLoop++ ) // need more finesse here //new profiles by Jazz - for ( ubLoop = 0; ubLoop < NUM_PROFILES; ubLoop++ ) // need more finesse here + for ( ubLoop = 0; ubLoop < NUM_PROFILES; ++ubLoop ) // need more finesse here { - //new profiles by Jazz - if ( gProfilesIMP[ubLoop].ProfilId == ubLoop || gProfilesAIM[ubLoop].ProfilId == ubLoop || gProfilesMERC[ubLoop].ProfilId == ubLoop ) - RefreshNPCScriptRecord( ubLoop, ubRecord ); + if ( gMercProfiles[ubLoop].Type == PROFILETYPE_AIM || + gMercProfiles[ubLoop].Type == PROFILETYPE_MERC || + gMercProfiles[ubLoop].Type == PROFILETYPE_IMP ) + RefreshNPCScriptRecord( ubLoop, ubRecord ); } -#ifdef JA2UB -//no UB -#else - //for ( ubLoop = GASTON; ubLoop < NUM_PROFILES; ubLoop++ ) // need more finesse here - //{ - // RefreshNPCScriptRecord( ubLoop, ubRecord ); - //} -#endif + //new profiles by Jazz //for ( ubLoop = FIRST_RPC; ubLoop < FIRST_NPC; ubLoop++ ) - for ( ubLoop = 0; ubLoop < NUM_PROFILES; ubLoop++ ) + for ( ubLoop = 0; ubLoop < NUM_PROFILES; ++ubLoop ) { - if ( gProfilesRPC[ubLoop].ProfilId == ubLoop ) + if ( gMercProfiles[ubLoop].Type == PROFILETYPE_RPC ) { - if ( gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED && gpBackupNPCQuoteInfoArray[ ubNPC ] != NULL ) - { - RefreshNPCScriptRecord( ubLoop, ubRecord ); - } + if ( gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED && gpBackupNPCQuoteInfoArray[ ubNPC ] != NULL ) + { + RefreshNPCScriptRecord( ubLoop, ubRecord ); + } } } + return( TRUE ); } @@ -534,6 +525,7 @@ BOOLEAN RefreshNPCScriptRecord( UINT8 ubNPC, UINT8 ubRecord ) MemFree( pNewArray ); } } + return( TRUE ); } @@ -730,30 +722,27 @@ void ShutdownNPCQuotes( void ) BOOLEAN ReloadAllQuoteFiles( void ) { - UINT8 ubProfile, ubLoop; - - //for ( ubProfile = FIRST_RPC; ubProfile < GASTON; ubProfile++ ) - //new profiles by Jazz - for ( ubProfile = 0; ubProfile < NUM_PROFILES; ubProfile++ ) + for ( UINT8 ubProfile = 0; ubProfile < NUM_PROFILES; ubProfile++ ) { - if ( gProfilesRPC[ubProfile].ProfilId == ubProfile || gProfilesNPC[ubProfile].ProfilId == ubProfile ) + if ( gMercProfiles[ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[ubProfile].Type == PROFILETYPE_NPC ) { - // zap backup if any - if ( gpBackupNPCQuoteInfoArray[ ubProfile ] != NULL ) - { - MemFree( gpBackupNPCQuoteInfoArray[ ubProfile ] ); - gpBackupNPCQuoteInfoArray[ ubProfile ] = NULL; - } - ReloadQuoteFileIfLoaded( ubProfile ); + // zap backup if any + if ( gpBackupNPCQuoteInfoArray[ ubProfile ] != NULL ) + { + MemFree( gpBackupNPCQuoteInfoArray[ ubProfile ] ); + gpBackupNPCQuoteInfoArray[ ubProfile ] = NULL; + } + ReloadQuoteFileIfLoaded( ubProfile ); } } + // reload all civ quote files - for ( ubLoop = 0; ubLoop < NUM_CIVQUOTE_SECTORS; ubLoop++ ) + for ( UINT8 ubLoop = 0; ubLoop < NUM_CIVQUOTE_SECTORS; ubLoop++ ) { ReloadCivQuoteFileIfLoaded( ubLoop ); } - return( TRUE ); } @@ -1499,7 +1488,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * default: //if ( usItemToConsider == MONEY && (ubNPC == SKYRIDER || (ubNPC >= FIRST_RPC && ubNPC < FIRST_NPC) ) ) //new profiles by Jazz - if ( usItemToConsider == MONEY && (ubNPC == SKYRIDER || ( gProfilesRPC[ubNPC].ProfilId == ubNPC ) ) ) + if ( usItemToConsider == MONEY && (ubNPC == SKYRIDER || gMercProfiles[ubNPC].Type == PROFILETYPE_RPC ) ) { if ( gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM ) { @@ -1891,11 +1880,10 @@ void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void ) return; } - //for ( ubLoop = FIRST_RPC; ubLoop < GASTON; ubLoop++ ) - //new profiles by Jazz - for ( UINT8 IDnpc = 0; IDnpc < NUM_PROFILES; IDnpc++ ) + for ( UINT8 IDnpc = 0; IDnpc < NUM_PROFILES; ++IDnpc ) { - if ( gProfilesRPC[IDnpc].ProfilId == IDnpc || gProfilesNPC[IDnpc].ProfilId == IDnpc) + if ( gMercProfiles[IDnpc].Type == PROFILETYPE_RPC || + gMercProfiles[IDnpc].Type == PROFILETYPE_NPC ) { if ( gMercProfiles[IDnpc].sSectorX == gWorldSectorX && gMercProfiles[IDnpc].sSectorY == gWorldSectorY && diff --git a/TileEngine/Tactical Placement GUI.cpp b/TileEngine/Tactical Placement GUI.cpp index 60660724..3ac5bdd4 100644 --- a/TileEngine/Tactical Placement GUI.cpp +++ b/TileEngine/Tactical Placement GUI.cpp @@ -443,11 +443,11 @@ void InitTacticalPlacementGUI() { ubFaceIndex = gMercProfiles[ gMercPlacement[ i ].pSoldier->ubProfile ].ubFaceIndex; - if ( ( ubFaceIndex < 100 ) && ( gProfilesIMP[ gMercPlacement[ i ].pSoldier->ubProfile ].ProfilId == gMercPlacement[ i ].pSoldier->ubProfile ) ) + if ( ( ubFaceIndex < 100 ) && gMercProfiles[gMercPlacement[i].pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", ubFaceIndex ); } - else if ( ( ubFaceIndex > 99 ) && ( gProfilesIMP[ gMercPlacement[ i ].pSoldier->ubProfile ].ProfilId == gMercPlacement[ i ].pSoldier->ubProfile ) ) + else if ( ( ubFaceIndex > 99 ) && gMercProfiles[gMercPlacement[i].pSoldier->ubProfile].Type == PROFILETYPE_IMP ) { sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", ubFaceIndex ); }