From 6f06b9ce7811d3e38651017e63d08e6cf122d853 Mon Sep 17 00:00:00 2001 From: Wanne Date: Mon, 18 Sep 2006 19:31:34 +0000 Subject: [PATCH] - bugfix (from build 529): IMPs have wrong voices - bugfix: Multiple IMPs with same voice causes wrong data and CTDs. Now it is impossible to have multiple IMPs with the same voice. No more invalid IMP data with multiple imps (hopefully) ;) - You can have a maximum number of 6 imps (3 women and 3 men). All have different voices - If an IMP is cloned (90210, nickname) an unused voice is set. So we have correct data - Prevent the user from selecting used voices in the IMP Voice selection screen git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@535 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.h | 1 + JA2.suo | Bin 197632 -> 197632 bytes Laptop/IMP Begin Screen.cpp | 86 ++++++++--- Laptop/IMP Compile Character.cpp | 241 ++++++++++++++++--------------- Laptop/IMP Confirm.cpp | 139 ++++++++---------- Laptop/IMP Confirm.h | 6 +- Laptop/IMP HomePage.cpp | 64 +++++--- Laptop/IMP MainPage.cpp | 79 ++++++++++ Laptop/IMP MainPage.h | 3 + Laptop/IMP Voices.cpp | 138 ++++++++++++------ Laptop/IMPVideoObjects.cpp | 7 +- Utils/_DutchText.cpp | 4 + Utils/_EnglishText.cpp | 4 + Utils/_FrenchText.cpp | 4 + Utils/_GermanText.cpp | 6 +- Utils/_ItalianText.cpp | 4 + Utils/_PolishText.cpp | 4 + Utils/_RussianText.cpp | 4 + 18 files changed, 494 insertions(+), 300 deletions(-) diff --git a/GameSettings.h b/GameSettings.h index a7bf1507..c5a615eb 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -143,6 +143,7 @@ typedef struct BOOLEAN fSellAll; INT16 iPriceModifier; + INT32 iMaxIMPMaleCharacters; INT32 iMaxIMPCharacters; INT32 iMinAttribute; INT32 iMaxAttribute; diff --git a/JA2.suo b/JA2.suo index 6278918a587de684c31145f1758205290adf39ba..a7f6ead5e450a8257afc6bc075bf1fbd80776ab7 100644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sFhOfRzhg3P=DudMeIn%MI3RM?qhcqrIGSIK8(f^|JAOhM89<)H}U){zy655Cu!>b z%y#~wTI~=>$9AVe4B|WU~deW0j={edoZ8BESoAe-Ek|jOtcDJO5 z^<7W8*ROkyHWdkFZ_+1dembx3j9uMA|7#-Ag$HYG~iIKZW&uZihrPzJ>%(Y6Z;pdO5G@co&(gT0PC|#^E>qk?x zNzij1qK|2h!@%FUFphgbJ?;nJ}QgWi`BN9sFuDoZxQMYmEoz64ddv3jam$ zD9J=O!ZGCI*F59$k#9|voIM+dSaI5HmEBxItIKm6j#KmnYT~Ua&gr2@Q^hf z>^qjrRR!v~xKJS(%9nqVZbn+yLyjG=Mlkp0S7KCZ!S`v3%rH~TL*)J5O<@Yjv`j%a z`mD(KjnextDg0T{$4TMOiat&Xe^$t(;IqPqXT`Bt_UxhY+i>s0xU;lqO};S8R|9#^ z*1&g{!9TB`WVy9+yt5jSYE{D9YcM|@;4!$!hk)Avb>OicF?AVmIYwRK6!(OXd}AuiFlags & BUTTON_ENABLED)) return; @@ -350,9 +352,8 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); + btn->uiFlags&=~(BUTTON_CLICKED_ON); - if( fFinishedCharGeneration ) { // simply reviewing name and gender, exit to finish page @@ -360,30 +361,76 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) fButtonPendingFlag = TRUE; return; } + /* else { - // WANNE: - /* if( CheckCharacterInputForEgg( ) ) { fEggOnYouFace = TRUE; } - */ + } + */ + + if (bProceed == TRUE) + { + // check to see if a name has been selected, if not, do not allow player to proceed with more char generation + if( ( pFullNameString[ 0 ] != 0) && ( pFullNameString[ 0 ] != L' ' ) && ( bGenderFlag != -1 ) ) + { + if (bGenderFlag == IMP_MALE) + { + if (GetFilledIMPSlots(MALE) >= 3) + { + // You cannot have more than 3 I.M.P characters with the same gender on your team. + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 9 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + bProceed = FALSE; + } + } + else if (bGenderFlag == IMP_FEMALE) + { + if (GetFilledIMPSlots(FEMALE) >= 3) + { + // You cannot have more than 3 I.M.P characters with the same gender on your team. + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 9 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + bProceed = FALSE; + } + } + } + else + { + // invalid name, reset current mode + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 2 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + iCurrentProfileMode = IMP__REGISTRY; + bProceed = FALSE; + } } + // Check if we can create an imp with the selected gender + // WANNE NEW + /*if (bProceed == TRUE) + { + if( FEMALE_GENDER_SELECT == ubTextEnterMode ) + { + bGenderFlag = IMP_FEMALE; + } + else if( MALE_GENDER_SELECT == ubTextEnterMode ) + { + bGenderFlag = IMP_MALE; + } + else + { + bProceed = FALSE; + } + }*/ - // back to mainpage - - - // check to see if a name has been selected, if not, do not allow player to proceed with more char generation - if( ( pFullNameString[ 0 ] != 0) && ( pFullNameString[ 0 ] != L' ' ) && ( bGenderFlag != -1 ) ) + // Data is valid + if (bProceed == TRUE) { // valid full name, check to see if nick name if( ( pNickNameString[ 0 ] == 0 ) || ( pNickNameString[ 0 ] == L' ')) { // no nick name // copy first name to nick name - CopyFirstNameIntoNickName( ); + CopyFirstNameIntoNickName( ); } // ok, now set back to main page, and set the fact we have completed part 1 if ( ( iCurrentProfileMode < IMP__PERSONALITY ) &&( bGenderFlag != -1 ) ) @@ -397,16 +444,9 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) // no easter egg?...then proceed along if( fEggOnYouFace == FALSE ) { - iCurrentImpPage = IMP_MAIN_PAGE; - fButtonPendingFlag = TRUE; + iCurrentImpPage = IMP_MAIN_PAGE; + fButtonPendingFlag = TRUE; } - - } - else - { - // invalid name, reset current mode - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 2 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); - iCurrentProfileMode = IMP__REGISTRY; } } } @@ -1003,7 +1043,7 @@ void DecrementTextEnterMode( void ) // if at IMP_FEMALE gender selection, reset to full name if( FULL_NAME_MODE == ubTextEnterMode) { - ubTextEnterMode = FEMALE_GENDER_SELECT; + ubTextEnterMode = FEMALE_GENDER_SELECT; } else { @@ -1185,7 +1225,7 @@ void MvtOnFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE) { - ubTextEnterMode = FEMALE_GENDER_SELECT; + ubTextEnterMode = FEMALE_GENDER_SELECT; fNewCharInString = TRUE; } } @@ -1199,7 +1239,7 @@ void MvtOnMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) } else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE) { - ubTextEnterMode = MALE_GENDER_SELECT; + ubTextEnterMode = MALE_GENDER_SELECT; fNewCharInString = TRUE; } } diff --git a/Laptop/IMP Compile Character.cpp b/Laptop/IMP Compile Character.cpp index 00cdd81a..08f972ab 100644 --- a/Laptop/IMP Compile Character.cpp +++ b/Laptop/IMP Compile Character.cpp @@ -249,85 +249,84 @@ BOOLEAN DoesCharacterHaveAPersoanlity( void ) void CreatePlayerAttitude( void ) { - // WANNE - if (gGameSettings.fOptions[ TOPTION_USE_RANDOM_PERSONALITY ] == TRUE) - //if(gGameExternalOptions.fPers_att) - { - AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); - AddAnAttitudeToAttitudeList( ATT_LONER ); - AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); - AddAnAttitudeToAttitudeList( ATT_ARROGANT ); - AddAnAttitudeToAttitudeList( ATT_NORMAL ); - AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); - AddAnAttitudeToAttitudeList( ATT_COWARD ); - AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); - AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); - AddAnAttitudeToAttitudeList( ATT_BIG_SHOT ); - // this function will 'roll a die' and decide if any attitude does exists - INT32 iDiceValue = 0; - INT32 iCounter = 0, iCounter2 = 0; - - INT32 iAttitudeHits[NUM_ATTITUDES] = { 0 }; - INT32 iHighestHits = 0; - INT32 iNumAttitudesWithHighestHits = 0; - - iAttitude = ATT_NORMAL; - - if ( iLastElementInAttitudeList == 0 ) + if(gGameSettings.fOptions[TOPTION_USE_RANDOM_PERSONALITY] == TRUE) { - return; - } + AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); + AddAnAttitudeToAttitudeList( ATT_LONER ); + AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); + AddAnAttitudeToAttitudeList( ATT_ARROGANT ); + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); + AddAnAttitudeToAttitudeList( ATT_COWARD ); + AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); + AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); + AddAnAttitudeToAttitudeList( ATT_BIG_SHOT ); - // count # of hits for each attitude - for ( iCounter = 0; iCounter < iLastElementInAttitudeList; iCounter++ ) - { - iAttitudeHits[ AttitudeList[ iCounter ] ]++; - } + // this function will 'roll a die' and decide if any attitude does exists + INT32 iDiceValue = 0; + INT32 iCounter = 0, iCounter2 = 0; - // find highest # of hits for any attitude - for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ ) - { - if ( iAttitudeHits[ iCounter ] ) + INT32 iAttitudeHits[NUM_ATTITUDES] = { 0 }; + INT32 iHighestHits = 0; + INT32 iNumAttitudesWithHighestHits = 0; + + iAttitude = ATT_NORMAL; + + if ( iLastElementInAttitudeList == 0 ) { - if ( iAttitudeHits[ iCounter ] > iHighestHits ) + return; + } + + // count # of hits for each attitude + for ( iCounter = 0; iCounter < iLastElementInAttitudeList; iCounter++ ) + { + iAttitudeHits[ AttitudeList[ iCounter ] ]++; + } + + // find highest # of hits for any attitude + for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ ) + { + if ( iAttitudeHits[ iCounter ] ) { - iHighestHits = __max( iHighestHits, iAttitudeHits[ iCounter ] ); - iNumAttitudesWithHighestHits = 1; + if ( iAttitudeHits[ iCounter ] > iHighestHits ) + { + iHighestHits = __max( iHighestHits, iAttitudeHits[ iCounter ] ); + iNumAttitudesWithHighestHits = 1; + } + else if ( iAttitudeHits[ iCounter ] == iHighestHits ) + { + iNumAttitudesWithHighestHits++; + } } - else if ( iAttitudeHits[ iCounter ] == iHighestHits ) + } + + // roll dice + iDiceValue = Random( iNumAttitudesWithHighestHits + 1 ); + + // find attitude + for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ ) + { + if ( iAttitudeHits[ iCounter ] == iHighestHits ) { - iNumAttitudesWithHighestHits++; + if ( iCounter2 == iDiceValue ) + { + // this is it! + iAttitude = iCounter2; + break; + } + else + { + // one of the next attitudes... + iCounter2++; + } } } } - - // roll dice - iDiceValue = Random( iNumAttitudesWithHighestHits + 1 ); - - // find attitude - for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ ) + else { - if ( iAttitudeHits[ iCounter ] == iHighestHits ) - { - if ( iCounter2 == iDiceValue ) - { - // this is it! - iAttitude = iCounter2; - break; - } - else - { - // one of the next attitudes... - iCounter2++; - } - } + iAttitude = gGameExternalOptions.iCustomAttitude; } - } - else - { - iAttitude = gGameExternalOptions.iCustomAttitude; - } } @@ -593,82 +592,84 @@ void AddAPersonalityToPersonalityList( INT8 bPersonlity ) void CreatePlayerPersonality( void ) { - // WANNE - if (gGameSettings.fOptions[ TOPTION_USE_RANDOM_PERSONALITY ] == TRUE) // Kaiden: Added for optional Mercenary personalities and attitudes - //if(gGameExternalOptions.fPers_att) - { - // Kaiden: More chances for Psycho and Normal. - AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); - AddAPersonalityToPersonalityList( PSYCHO ); - AddAPersonalityToPersonalityList( FORGETFUL ); - AddAPersonalityToPersonalityList( NERVOUS ); - AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); - AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); - AddAPersonalityToPersonalityList( PSYCHO ); - AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); - AddAPersonalityToPersonalityList( NONSWIMMER ); - AddAPersonalityToPersonalityList( FEAR_OF_INSECTS ); - AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); - AddAPersonalityToPersonalityList( PSYCHO ); - AddAPersonalityToPersonalityList( FORGETFUL ); - AddAPersonalityToPersonalityList( NERVOUS ); - AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); - AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); - AddAPersonalityToPersonalityList( PSYCHO ); - AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); - AddAPersonalityToPersonalityList( NONSWIMMER ); - AddAPersonalityToPersonalityList( FEAR_OF_INSECTS ); - INT32 iDiceValue = 0; - INT32 iCounter = 0; - INT32 iCounter2 = 0; - - // Kaiden: Roll dice 20 times just to be on the safe side - // was getting too many repeats. Will end up scrapping - // rand() later anyway so will worry about fixing it then. - - // WANNE: No need to make a 20 times repeat - /*for (iCounter2 = 0; iCounter2 < 20; iCounter2++) + if(gGameSettings.fOptions[TOPTION_USE_RANDOM_PERSONALITY] == TRUE) { - iDiceValue = Random( iLastElementInPersonalityList + 1 ); - }*/ + // Kaiden: More chances for Psycho and Normal. + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( FORGETFUL ); + AddAPersonalityToPersonalityList( NERVOUS ); + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + AddAPersonalityToPersonalityList( NONSWIMMER ); + AddAPersonalityToPersonalityList( FEAR_OF_INSECTS ); + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( FORGETFUL ); + AddAPersonalityToPersonalityList( NERVOUS ); + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + AddAPersonalityToPersonalityList( NONSWIMMER ); + AddAPersonalityToPersonalityList( FEAR_OF_INSECTS ); - iDiceValue = Random( iLastElementInPersonalityList + 1 ); - // Kaiden two chances to avoid a normal personality. As IMP - // says, They check it twice just to make sure :p - for( iCounter = 0; iCounter < iLastElementInPersonalityList; iCounter++ ) - { - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("iDiceValue = %d",iDiceValue)); + INT32 iDiceValue = 0; + INT32 iCounter = 0; + INT32 iCounter2 = 0; - if( PersonalityList[ iDiceValue ] == NO_PERSONALITYTRAIT ) + // Kaiden: Roll dice 20 times just to be on the safe side + // was getting too many repeats. Will end up scrapping + // rand() later anyway so will worry about fixing it then. + for (iCounter2 = 0; iCounter2 < 20; iCounter2++) { - //Kaiden: Roll one more time for good measure: iDiceValue = Random( iLastElementInPersonalityList + 1 ); } + + // Kaiden two chances to avoid a normal personality. As IMP + // says, They check it twice just to make sure :p + for( iCounter = 0; iCounter < iLastElementInPersonalityList; iCounter++ ) + { + + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("iDiceValue = %d",iDiceValue)); + + if( PersonalityList[ iDiceValue ] == NO_PERSONALITYTRAIT ) + { + //Kaiden: Roll one more time for good measure: + iDiceValue = Random( iLastElementInPersonalityList + 1 ); + } + } + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("And our Personality is... = %d",PersonalityList[ iDiceValue ])); + iPersonality = PersonalityList[ iDiceValue ]; + } + else + { + iPersonality = gGameExternalOptions.iCustomPersonality; } - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("And our Personality is... = %d",PersonalityList[ iDiceValue ])); - iPersonality = PersonalityList[ iDiceValue ]; - } - else - { - iPersonality = gGameExternalOptions.iCustomPersonality; - } return; + } void CreatePlayersPersonalitySkillsAndAttitude( void ) { + + + + // creates personality, skills and attitudes from curretly built list // personality CreatePlayerPersonality( ); // skills are now created later after stats have been chosen - //CreatePlayerSkills( ); + //CreatePlayerSkills( ); // attitude CreatePlayerAttitude( ); @@ -932,7 +933,7 @@ void HandleMercStatsForChangesInFace( ) return; } - //add the skills to the skills listgMercProfiles + //add the skills to the skills list AddSelectedSkillsToSkillsList(); // now figure out skills diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index d866f695..e0093ebb 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -210,46 +210,11 @@ void DestroyConfirmButtons( void ) return; } -INT32 GetCurrentIMPSlot( void ) -{ - INT16 iFilledSlot = PLAYER_GENERATED_CHARACTER_ID; - INT16 i; - - for (i = PLAYER_GENERATED_CHARACTER_ID + gGameExternalOptions.iMaxIMPCharacters - 1; i >= PLAYER_GENERATED_CHARACTER_ID; i--) - { - // We found the current imp - if (wcscmp( gMercProfiles[i].zName, L"") != 0) - { - iFilledSlot = i; - break; - } - } - - return iFilledSlot; -} - -// WANNE 10: -INT32 GetNextFreeIMPSlot( void ) -{ - INT16 iFreeSlot = -1; - INT16 i; - - for (i = PLAYER_GENERATED_CHARACTER_ID; i < PLAYER_GENERATED_CHARACTER_ID + gGameExternalOptions.iMaxIMPCharacters; i++) - { - if (wcscmp( gMercProfiles[i].zName, L"") == 0) - { - iFreeSlot = i; - break; - } - } - - return iFreeSlot; -} BOOLEAN AddCharacterToPlayersTeam( void ) { - INT32 iFreeIMPSlot = 0; + MERC_HIRE_STRUCT HireMercStruct; @@ -260,10 +225,8 @@ BOOLEAN AddCharacterToPlayersTeam( void ) memset(&HireMercStruct, 0, sizeof(MERC_HIRE_STRUCT)); - //HireMercStruct.ubProfileID = ( UINT8 )( PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ) ; - - // Get the current imp slot (imp is already stored) - HireMercStruct.ubProfileID = GetCurrentIMPSlot(); + // WANNE NEW: Any changes here. I don't think so + HireMercStruct.ubProfileID = ( UINT8 )( PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ) ; if( fLoadingCharacterForPreviousImpProfile == FALSE ) { @@ -352,7 +315,6 @@ void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) //Kaiden: And here is my Answer to the IMP E-mails only // profiling the last IMP made. You get the results immediately - // But they should become different per different IMP. AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ); //RenderCharProfile( ); @@ -727,23 +689,30 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId, STR fileName ) // write out the profile id if (!FileWrite(hFile, &iProfileId, sizeof( INT32 ), &uiBytesWritten)) { + if (hFile) + FileClose(hFile); return; } // write out the portrait id if (!FileWrite(hFile, &iPortraitNumber, sizeof( INT32 ), &uiBytesWritten)) { + if (hFile) + FileClose(hFile); return; } // write out the profile itself if (!FileWrite(hFile, &gMercProfiles[ iProfileId ], sizeof( MERCPROFILESTRUCT ), &uiBytesWritten)) { + if (hFile) + FileClose(hFile); return; } // close file - FileClose(hFile); + if (hFile) + FileClose(hFile); return; } @@ -761,7 +730,7 @@ BOOLEAN ImpExists ( STR nickName ) return FileExistsNoDB(zFileName); } -void LoadImpCharacter( STR nickName ) +BOOLEAN LoadImpCharacter( STR nickName ) { INT32 iProfileId = 0; HWFILE hFile; @@ -778,57 +747,73 @@ void LoadImpCharacter( STR nickName ) // valid file? if( hFile == -1 ) { - return; + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; } // read in the profile + if (!FileRead(hFile, &iProfileId,sizeof( INT32 ), &uiBytesRead)) { - return; + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; } // read in the portrait if (!FileRead(hFile, &iPortraitNumber ,sizeof( INT32 ), &uiBytesRead)) { - return; + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; } - // WANNE 10: set the next free profile id for the new imp - iProfileId = GetNextFreeIMPSlot(); + // Set the ID of the new IMP + iProfileId = GetFreeIMPSlot(iProfileId); - // read in the profile - if (!FileRead(hFile, &gMercProfiles[ iProfileId ] ,sizeof( MERCPROFILESTRUCT ), &uiBytesRead)) + // We can create the new imp, beacuse we found an empty slot + if (iProfileId != -1) { - return; - } + LaptopSaveInfo.iVoiceId = iProfileId - PLAYER_GENERATED_CHARACTER_ID; - // close file - FileClose(hFile); - - if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) + // read in the profile + if (!FileRead(hFile, &gMercProfiles[ iProfileId ] ,sizeof( MERCPROFILESTRUCT ), &uiBytesRead)) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; + } + + // close file + FileClose(hFile); + + if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + + // not enough + return FALSE; + } + + + // charge the player + // is the character male? + fCharacterIsMale = ( gMercProfiles[ iProfileId ].bSex == MALE ); + fLoadingCharacterForPreviousImpProfile = TRUE; + AddTransactionToPlayersBook(IMP_PROFILE,0, GetWorldTotalMin( ), - ( COST_OF_PROFILE ) ); + AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); + LaptopSaveInfo.iVoiceId = iProfileId - PLAYER_GENERATED_CHARACTER_ID; + AddCharacterToPlayersTeam( ); + AddFutureDayStrategicEvent( EVENT_DAY2_ADD_EMAIL_FROM_IMP, 60 * 7, 0, 2 ); + LaptopSaveInfo.fIMPCompletedFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; + fLoadingCharacterForPreviousImpProfile = FALSE; + + return TRUE; + } + else { - // not enough - return; + // You cannot have more than 3 I.M.P characters with the same gender on your team. + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 9 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return FALSE; } - - - // charge the player - // is the character male? - fCharacterIsMale = ( gMercProfiles[ iProfileId ].bSex == MALE ); - fLoadingCharacterForPreviousImpProfile = TRUE; - AddTransactionToPlayersBook(IMP_PROFILE,0, GetWorldTotalMin( ), - ( COST_OF_PROFILE ) ); - AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); - - - LaptopSaveInfo.iVoiceId = iProfileId - PLAYER_GENERATED_CHARACTER_ID; - - AddCharacterToPlayersTeam( ); - AddFutureDayStrategicEvent( EVENT_DAY2_ADD_EMAIL_FROM_IMP, 60 * 7, 0, 2 ); - LaptopSaveInfo.fIMPCompletedFlag = TRUE; - fPausedReDrawScreenFlag = TRUE; - fLoadingCharacterForPreviousImpProfile = FALSE; - - return; } diff --git a/Laptop/IMP Confirm.h b/Laptop/IMP Confirm.h index 7dd898e7..b1aeaead 100644 --- a/Laptop/IMP Confirm.h +++ b/Laptop/IMP Confirm.h @@ -7,7 +7,7 @@ void ExitIMPConfirm( void ); void HandleIMPConfirm( void ); BOOLEAN AddCharacterToPlayersTeam( void ); -void LoadImpCharacter( STR fileName ); +BOOLEAN LoadImpCharacter( STR fileName ); void WriteOutCurrentImpCharacter( INT32 iProfileId ); void WriteOutCurrentImpCharacter( INT32 iProfileId, STR fileName ); @@ -15,9 +15,5 @@ void ResetIMPCharactersEyesAndMouthOffsets( UINT8 ubMercProfileID ); BOOLEAN ImpExists ( STR fileName ); -// WANNE: Determines the free and current slot of the imp in the gMercProfiles array -INT32 GetNextFreeIMPSlot( void ); -INT32 GetCurrentIMPSlot( void ); - #endif diff --git a/Laptop/IMP HomePage.cpp b/Laptop/IMP HomePage.cpp index ffe767bc..c0dcceb4 100644 --- a/Laptop/IMP HomePage.cpp +++ b/Laptop/IMP HomePage.cpp @@ -382,8 +382,6 @@ void HandleTextEvent( UINT32 uiKey ) void ProcessPlayerInputActivationString( void ) { - INT16 iNextSlot = -1; - // prcess string to see if it matches activation string if( NumberOfMercsOnPlayerTeam() >= 18 ) @@ -392,45 +390,63 @@ void ProcessPlayerInputActivationString( void ) char charPlayerActivationString[32]; wcstombs(charPlayerActivationString,pPlayerActivationString,32); - iNextSlot = GetNextFreeIMPSlot(); - - // We have at least one more free slot for a imp character - if (iNextSlot != -1) + //Madd multiple imps if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) )&&( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) + if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) { - //Madd multiple imps if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) )&&( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) - if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) + if (GetFilledIMPSlots(-1) < gGameExternalOptions.iMaxIMPCharacters) { // Kaiden: Need to reset skills, attributes and personalities with the new UB Method. ResetSkillsAttributesAndPersonality( ); ClearAllSkillsList( ); iCurrentImpPage = IMP_MAIN_PAGE; - - } - //Madd multiple imps else if( ( wcscmp(pPlayerActivationString, L"90210") == 0 ) && ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) ) - else if( wcscmp(pPlayerActivationString, L"90210") == 0 ) - { - LoadImpCharacter( IMP_MERC_FILENAME ); - } - // Madd: load characters by name - else if ( ImpExists( charPlayerActivationString ) ) - { - LoadImpCharacter( charPlayerActivationString ); } else { - if( ( ( wcscmp(pPlayerActivationString, L"XEP624") != 0 ) && ( wcscmp(pPlayerActivationString, L"xep624") != 0 ) ) ) + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 8 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + } + //Madd multiple imps else if( ( wcscmp(pPlayerActivationString, L"90210") == 0 ) && ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) ) + else if( wcscmp(pPlayerActivationString, L"90210") == 0 ) + { + if (GetFilledIMPSlots(-1) < gGameExternalOptions.iMaxIMPCharacters) + { + if (LoadImpCharacter( IMP_MERC_FILENAME ) == TRUE) { - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 0 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + //DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 11 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ); } - else if( LaptopSaveInfo.fIMPCompletedFlag == TRUE ) + } + else + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 8 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + } + // Madd: load characters by name + else if ( ImpExists( charPlayerActivationString ) ) + { + if (GetFilledIMPSlots(-1) < gGameExternalOptions.iMaxIMPCharacters) + { + if (LoadImpCharacter( charPlayerActivationString ) == TRUE) { - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 6 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + //DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 11 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ), PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ); } } + else + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 8 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } } else { - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 7 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + if( ( ( wcscmp(pPlayerActivationString, L"XEP624") != 0 ) && ( wcscmp(pPlayerActivationString, L"xep624") != 0 ) ) ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 0 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + else if( LaptopSaveInfo.fIMPCompletedFlag == TRUE ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 6 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } } return; diff --git a/Laptop/IMP MainPage.cpp b/Laptop/IMP MainPage.cpp index df21a74f..2e1ac330 100644 --- a/Laptop/IMP MainPage.cpp +++ b/Laptop/IMP MainPage.cpp @@ -798,6 +798,85 @@ void IMPMainPageNotSelectableBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) return; } +// WANNE NEW +INT32 GetFilledIMPSlots( INT8 iSex ) +{ + INT32 i; + INT32 iCount = 0; + INT32 iStart; + INT32 iEnd; + + // Only count the free imp male slots + if (iSex == MALE) + { + iStart = PLAYER_GENERATED_CHARACTER_ID; + iEnd = iStart + 3; + } + // Only count the free imp female slots + else if (iSex == FEMALE) + { + iStart = PLAYER_GENERATED_CHARACTER_ID + 3; + iEnd = iStart + 3; + } + // Count all free imp slots + else + { + iStart = PLAYER_GENERATED_CHARACTER_ID; + iEnd = PLAYER_GENERATED_CHARACTER_ID + 6; + } + + for (i = iStart; i < iEnd; i++) + { + // We found a free slot + if (wcscmp(gMercProfiles[i].zName, L"") != 0) + { + iCount++; + } + } + + // Return the number of free imp slots + return iCount; +} + +// WANNE NEW +INT32 GetFreeIMPSlot(INT32 iIMPId) +{ + INT32 iStart; + INT32 iEnd; + INT32 i; + INT32 iFreeSlot = -1; + + if (iIMPId != -1) + { + // Female + if (iIMPId >= PLAYER_GENERATED_CHARACTER_ID + 3) + { + iStart = PLAYER_GENERATED_CHARACTER_ID + 3; + iEnd = PLAYER_GENERATED_CHARACTER_ID + 6; + } + // Male + else + { + iStart = PLAYER_GENERATED_CHARACTER_ID; + iEnd = PLAYER_GENERATED_CHARACTER_ID + 3; + } + + // Find a free imp slot + for (i = iStart; i < iEnd; i++) + { + // Found a free imp slot + if (wcscmp(gMercProfiles[i].zName, L"") == 0) + { + iFreeSlot = i; + break; + } + } + + } + + return iFreeSlot; +} + BOOLEAN LoadCharacterPortraitForMainPage( void ) { diff --git a/Laptop/IMP MainPage.h b/Laptop/IMP MainPage.h index ec5e99c2..e8028415 100644 --- a/Laptop/IMP MainPage.h +++ b/Laptop/IMP MainPage.h @@ -9,6 +9,9 @@ void HandleIMPMainPage( void ); void NextProfilingMode( void ); void ShadeUnSelectableButtons( void ); +// WANNE NEW +INT32 GetFreeIMPSlot(INT32 iIMPId); +INT32 GetFilledIMPSlots( INT8 iSex ); extern INT32 iCurrentProfileMode; diff --git a/Laptop/IMP Voices.cpp b/Laptop/IMP Voices.cpp index 33723680..d54bfc43 100644 --- a/Laptop/IMP Voices.cpp +++ b/Laptop/IMP Voices.cpp @@ -2,7 +2,6 @@ #include "Laptop All.h" #else #include "CharProfile.h" - #include "IMP Confirm.h" #include "IMP Voices.h" #include "IMP MainPage.h" #include "IMP HomePage.h" @@ -23,8 +22,11 @@ #endif //current and last pages + +// WANNE NEW: Set iLastVoice dynamically, skip used voices INT32 iCurrentVoices = 0; -INT32 iLastVoice = 2; + +INT32 iVoiceId = 0; //INT32 iVoiceId = 0; @@ -67,7 +69,11 @@ void EnterIMPVoices( void ) fVoiceBVisited = FALSE; fVoiceCVisited = FALSE; - // create buttons + // Set the initialize voice + iVoiceId = -1; + IncrementVoice(); + + // create buttons CreateIMPVoicesButtons( ); // create mouse regions @@ -79,21 +85,6 @@ void EnterIMPVoices( void ) // play voice once uiVocVoiceSound = PlayVoice( ); - //if the character is a male - if( fCharacterIsMale ) - { - iLastVoice = 2; - } - else - { - iLastVoice = 2; - } - - if( iCurrentVoices > iLastVoice ) - { - iCurrentVoices = iLastVoice; - } - return; } @@ -150,21 +141,55 @@ void HandleIMPVoices( void ) return; } +BOOLEAN IsIMPSlotFree(INT32 iIMPId) +{ + if (wcscmp(gMercProfiles[iIMPId].zName, L"") == 0) + { + return TRUE; + } + else + { + return FALSE; + } +} - - +// WANNE NEW void IncrementVoice( void ) { - // cycle to next voice - - iCurrentVoices++; + INT32 iIMPIndex = -1; + INT32 iOffset; + INT32 i; - // gone too far? - if( iCurrentVoices > iLastVoice ) + iVoiceId++; + + if (iVoiceId > 2) + iVoiceId = 0; + + if (fCharacterIsMale == TRUE) + iOffset = 0; + else + iOffset = 3; + + // Just to be save (so we use no endless loop) + for (i = 0; i < 20; i++) { - iCurrentVoices = 0; + if (IsIMPSlotFree(PLAYER_GENERATED_CHARACTER_ID + iOffset + iVoiceId) == TRUE) + { + // This is the free imp index + iIMPIndex = PLAYER_GENERATED_CHARACTER_ID + iOffset + iVoiceId; + break; + } + + iVoiceId++; + + // Upper range -> Reset to 0 + if (iVoiceId > 2) + iVoiceId = 0; } + // Set the voice id of the free slot + iCurrentVoices = iIMPIndex - iOffset - PLAYER_GENERATED_CHARACTER_ID; + iVoiceId = iCurrentVoices; return; } @@ -172,17 +197,42 @@ void IncrementVoice( void ) void DecrementVoice( void ) { - // cycle to previous voice - - iCurrentVoices--; + INT32 iIMPIndex = -1; + INT32 iOffset; + INT32 i; - // gone too far? - if( iCurrentVoices < 0 ) + iVoiceId--; + + if (iVoiceId < 0) + iVoiceId = 2; + + if (fCharacterIsMale == TRUE) + iOffset = 0; + else + iOffset = 3; + + // Just to be save (so we use no endless loop) + for (i = 0; i < 20; i++) { - iCurrentVoices = iLastVoice; + if (IsIMPSlotFree(PLAYER_GENERATED_CHARACTER_ID + iOffset + iVoiceId) == TRUE) + { + // This is the free imp index + iIMPIndex = PLAYER_GENERATED_CHARACTER_ID + iOffset + iVoiceId; + break; + } + + iVoiceId--; + + // Upper range -> Reset to 0 + if (iVoiceId < 0) + iVoiceId = 2; } - return; + // Set the voice id of the free slot + iCurrentVoices = iIMPIndex - iOffset - PLAYER_GENERATED_CHARACTER_ID; + iVoiceId = iCurrentVoices; + + return; } @@ -284,7 +334,7 @@ void BtnIMPVoicesNextCallback(GUI_BUTTON *btn,INT32 reason) // play voice if( ! SoundIsPlaying( uiVocVoiceSound ) ) { - uiVocVoiceSound = PlayVoice( ); + uiVocVoiceSound = PlayVoice( ); } else { @@ -386,18 +436,14 @@ void BtnIMPVoicesDoneCallback(GUI_BUTTON *btn,INT32 reason) // set voice id, to grab character slot // WANNE 10: - //if( fCharacterIsMale == TRUE ) - //{ - // LaptopSaveInfo.iVoiceId = iCurrentVoices; - //} - //else - //{ - // LaptopSaveInfo.iVoiceId = iCurrentVoices + 3; - //} - - // Get the next free imp slot - LaptopSaveInfo.iVoiceId = GetNextFreeIMPSlot() - PLAYER_GENERATED_CHARACTER_ID; - + if( fCharacterIsMale == TRUE ) + { + LaptopSaveInfo.iVoiceId = iCurrentVoices; + } + else + { + LaptopSaveInfo.iVoiceId = iCurrentVoices + 3; + } // set button up image pending fButtonPendingFlag = TRUE; diff --git a/Laptop/IMPVideoObjects.cpp b/Laptop/IMPVideoObjects.cpp index 38b81531..baf08c4f 100644 --- a/Laptop/IMPVideoObjects.cpp +++ b/Laptop/IMPVideoObjects.cpp @@ -98,19 +98,18 @@ void RenderProfileBackGround( void ) // get the video object GetVideoObject(&hHandle, guiBACKGROUND); - - // WANNE + // render each row 5 times wide, 5 tiles high for(iCounter = 0; iCounter < 4; iCounter++) { + // blt background to screen from left to right BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 0 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); - BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 1 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 1 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 2 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 3 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); } - // dirty buttons MarkButtonsDirty( ); diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index fec91596..ce7aea71 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -2075,7 +2075,11 @@ STR16 pImpPopUpStrings[] = L"Geen geldige optie op dit moment.", L"Om een nauwkeurig profiel te maken, moet je ruimte hebben voor tenminste één teamlid.", L"Profiel is al gemaakt.", + L"Cannot load I.M.P. character from disk.", L"You have already reached the maximum number of I.M.P. characters.", + L"You have already three I.M.P characters with the same gender on your team.", + L"You cannot afford the I.M.P character.", + L"The new I.M.P character has joined your team.", }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 800a756e..e366f96a 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -2076,7 +2076,11 @@ STR16 pImpPopUpStrings[] = L"Not a valid option at this time.", L"To complete an accurate profile, you must have room for at least one team member.", L"Profile already completed.", + L"Cannot load I.M.P. character from disk.", L"You have already reached the maximum number of I.M.P. characters.", + L"You have already three I.M.P characters with the same gender on your team.", + L"You cannot afford the I.M.P character.", + L"The new I.M.P character has joined your team.", }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 27ab5954..7f9f757a 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -2064,7 +2064,11 @@ STR16 pImpPopUpStrings[] = L"Option inaccessible pour le moment.", L"Pour que cette analyse soit efficace, il doit vous rester au moins une place dans votre escouade.", L"Profil déjà établi.", + L"Cannot load I.M.P. character from disk.", L"You have already reached the maximum number of I.M.P. characters.", + L"You have already three I.M.P characters with the same gender on your team.", + L"You cannot afford the I.M.P character.", + L"The new I.M.P character has joined your team.", }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 17179a89..d12f96b2 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -1992,7 +1992,11 @@ STR16 pImpPopUpStrings[] = L"Option zur Zeit nicht gültig.", L"Um eine genaue Evaluierung durchzuführen, müssen Sie mindestens noch ein Teammitglied aufnehmen können.", L"Evaluierung bereits durchgeführt.", - L"Sie habe bereits die maximale Anzahl an B.S.E Charakteren.", + L"Fehler beim Laden des B.S.E. Charakters.", + L"Sie haben bereits die maximale Anzahl an B.S.E. Charakteren.", + L"Sie haben bereits drei B.S.E. Charaktere mit dem gleichen Geschlecht.", + L"Sie können sich den I.M.P. Charakter nicht leisten.", + L"Der neue B.S.E. Charakter ist nun in ihrem Team.", }; // button labels used on the IMP site diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 39f67bcb..436916c0 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -2058,7 +2058,11 @@ STR16 pImpPopUpStrings[] = L"Opzione non valida questa volta.", L"Per completare un profilo accurato, dovete aver spazio per almeno uno dei membri della squadra.", L"Profilo già completato.", + L"Cannot load I.M.P. character from disk.", L"You have already reached the maximum number of I.M.P. characters.", + L"You have already three I.M.P characters with the same gender on your team.", + L"You cannot afford the I.M.P character.", + L"The new I.M.P character has joined your team.", }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 02a217f6..af43e8f9 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2058,7 +2058,11 @@ STR16 pImpPopUpStrings[] = L"Opcja tym razem nieaktywna.", L"Aby wykonaæ profil, musisz mieæ miejsce dla przynajmniej jednego cz³onka za³ogi.", L"Profil zosta³ ju¿ wykonany.", + L"Cannot load I.M.P. character from disk.", L"You have already reached the maximum number of I.M.P. characters.", + L"You have already three I.M.P characters with the same gender on your team.", + L"You cannot afford the I.M.P character.", + L"The new I.M.P character has joined your team.", }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 460bae7f..96406328 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -2067,7 +2067,11 @@ STR16 pImpPopUpStrings[] = L"Ñåé÷àñ âû íå ìîæåòå âûáðàòü ýòî.", L"×òîáû çàêîí÷èòü àíàëèç,íóæíî èìåòü ìåñòî åùå õîòÿ áû äëÿ îäíîãî ÷ëåíà êîìàíäû.", L"Àíàëèç óæå çàâåðøåí.", + L"Cannot load I.M.P. character from disk.", L"You have already reached the maximum number of I.M.P. characters.", + L"You have already three I.M.P characters with the same gender on your team.", + L"You cannot afford the I.M.P character.", + L"The new I.M.P character has joined your team.", };