mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
- bugfix: Getting incorrect data & CTDs when using multiple IMP characters with same voices. Now it is possible to have up to 6 merc with the same voice without getting incorrect data. No more need to use different voices! (IF YOU PLAY WITH MULTIPLE IMPS, YOU SHOULD START A NEW GAME, BECAUSE THE IMP CHARACTERS GAME DATA IS INCORRECT!)
- bugfix: CTD when using Random personality in I.M.P creation - moved Random personality flag from INI to option screen - added MAX_IMP_CHARACTERS entry in the ja2_options.ini (Range: 0 - 6) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@528 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+120
-121
@@ -249,84 +249,85 @@ 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 );
|
||||
|
||||
if(gGameExternalOptions.fPers_att)
|
||||
// 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 )
|
||||
{
|
||||
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 );
|
||||
return;
|
||||
}
|
||||
|
||||
// this function will 'roll a die' and decide if any attitude does exists
|
||||
INT32 iDiceValue = 0;
|
||||
INT32 iCounter = 0, iCounter2 = 0;
|
||||
// count # of hits for each attitude
|
||||
for ( iCounter = 0; iCounter < iLastElementInAttitudeList; iCounter++ )
|
||||
{
|
||||
iAttitudeHits[ AttitudeList[ iCounter ] ]++;
|
||||
}
|
||||
|
||||
INT32 iAttitudeHits[NUM_ATTITUDES] = { 0 };
|
||||
INT32 iHighestHits = 0;
|
||||
INT32 iNumAttitudesWithHighestHits = 0;
|
||||
|
||||
iAttitude = ATT_NORMAL;
|
||||
|
||||
if ( iLastElementInAttitudeList == 0 )
|
||||
// find highest # of hits for any attitude
|
||||
for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ )
|
||||
{
|
||||
if ( iAttitudeHits[ iCounter ] )
|
||||
{
|
||||
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 ] )
|
||||
if ( iAttitudeHits[ iCounter ] > iHighestHits )
|
||||
{
|
||||
if ( iAttitudeHits[ iCounter ] > iHighestHits )
|
||||
{
|
||||
iHighestHits = __max( iHighestHits, iAttitudeHits[ iCounter ] );
|
||||
iNumAttitudesWithHighestHits = 1;
|
||||
}
|
||||
else if ( iAttitudeHits[ iCounter ] == iHighestHits )
|
||||
{
|
||||
iNumAttitudesWithHighestHits++;
|
||||
}
|
||||
iHighestHits = __max( iHighestHits, iAttitudeHits[ iCounter ] );
|
||||
iNumAttitudesWithHighestHits = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// roll dice
|
||||
iDiceValue = Random( iNumAttitudesWithHighestHits + 1 );
|
||||
|
||||
// find attitude
|
||||
for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ )
|
||||
{
|
||||
if ( iAttitudeHits[ iCounter ] == iHighestHits )
|
||||
else if ( iAttitudeHits[ iCounter ] == iHighestHits )
|
||||
{
|
||||
if ( iCounter2 == iDiceValue )
|
||||
{
|
||||
// this is it!
|
||||
iAttitude = iCounter2;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// one of the next attitudes...
|
||||
iCounter2++;
|
||||
}
|
||||
iNumAttitudesWithHighestHits++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// roll dice
|
||||
iDiceValue = Random( iNumAttitudesWithHighestHits + 1 );
|
||||
|
||||
// find attitude
|
||||
for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ )
|
||||
{
|
||||
iAttitude = gGameExternalOptions.iCustomAttitude;
|
||||
if ( iAttitudeHits[ iCounter ] == iHighestHits )
|
||||
{
|
||||
if ( iCounter2 == iDiceValue )
|
||||
{
|
||||
// this is it!
|
||||
iAttitude = iCounter2;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// one of the next attitudes...
|
||||
iCounter2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iAttitude = gGameExternalOptions.iCustomAttitude;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -592,84 +593,82 @@ 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 );
|
||||
|
||||
if(gGameExternalOptions.fPers_att)
|
||||
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++)
|
||||
{
|
||||
// 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 );
|
||||
}*/
|
||||
|
||||
iDiceValue = Random( iLastElementInPersonalityList + 1 );
|
||||
|
||||
INT32 iDiceValue = 0;
|
||||
INT32 iCounter = 0;
|
||||
INT32 iCounter2 = 0;
|
||||
// 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));
|
||||
|
||||
// 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; iCounter < 20; iCounter2++)
|
||||
if( PersonalityList[ iDiceValue ] == NO_PERSONALITYTRAIT )
|
||||
{
|
||||
//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( );
|
||||
@@ -933,7 +932,7 @@ void HandleMercStatsForChangesInFace( )
|
||||
return;
|
||||
}
|
||||
|
||||
//add the skills to the skills list
|
||||
//add the skills to the skills listgMercProfiles
|
||||
AddSelectedSkillsToSkillsList();
|
||||
|
||||
// now figure out skills
|
||||
|
||||
Reference in New Issue
Block a user