- The number of possible IMP voices is no lnger limited

- If no IMP voices could be read, IMP creation is not allowed

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8368 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2017-01-17 20:32:31 +00:00
parent ec52ab30e5
commit 9a46c2a9fc
12 changed files with 24 additions and 12 deletions
+1 -3
View File
@@ -60,9 +60,7 @@ typedef struct
BOOLEAN exists; // set upon reading the xml: this voice exists
} IMP_VOICESET;
#define NUM_IMP_VOICESETS 100
extern IMP_VOICESET gIMPVoice[NUM_IMP_VOICESETS];
extern std::vector<IMP_VOICESET> gIMPVoice;
BOOLEAN AddCharacterToPlayersTeam( void );
BOOLEAN LoadImpCharacter( STR fileName );
+7
View File
@@ -401,6 +401,13 @@ void ProcessPlayerInputActivationString( void )
return;
}
// Flugente: don't proceed if there are no voices
if ( gIMPVoice.empty() )
{
DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[13], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL );
return;
}
if (CountFilledIMPSlots(-1) < gGameOptions.ubMaxIMPCharacters)
{
// Kaiden: Need to reset skills, attributes and personalities with the new UB Method.
+4 -4
View File
@@ -55,7 +55,7 @@ void IMPPortraitRegionButtonCallback(MOUSE_REGION * pRegion, INT32 iReason );
void EnterIMPVoices( void )
{
// Set the initial voice
for ( int i = 0; i < NUM_IMP_VOICESETS; ++i )
for ( int i = 0; i < gIMPVoice.size(); ++i )
{
// MALE is 0, FEMALE is 1, thus the negation
if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex )
@@ -124,7 +124,7 @@ void IncrementVoice()
{
++iCurrentVoice;
for ( int i = iCurrentVoice; i < NUM_IMP_VOICESETS; ++i )
for ( int i = iCurrentVoice; i < gIMPVoice.size( ); ++i )
{
if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex )
{
@@ -134,7 +134,7 @@ void IncrementVoice()
}
// still here? Start from the beginning then
for ( int i = 0; i < NUM_IMP_VOICESETS; ++i )
for ( int i = 0; i < gIMPVoice.size( ); ++i )
{
if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex )
{
@@ -158,7 +158,7 @@ void DecrementVoice( void )
}
// still here? Start from the beginning then
for ( int i = NUM_IMP_VOICESETS - 1; i > 0; --i )
for ( int i = gIMPVoice.size( ) - 1; i > 0; --i )
{
if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex )
{
+4 -5
View File
@@ -23,7 +23,7 @@ struct
}
typedef impVoiceParseData;
IMP_VOICESET gIMPVoice[NUM_IMP_VOICESETS];
std::vector<IMP_VOICESET> gIMPVoice;
static void XMLCALL
impVoicesStartElementHandle( void *userData, const XML_Char *name, const XML_Char **atts )
@@ -87,10 +87,9 @@ impVoicesEndElementHandle( void *userData, const XML_Char *name )
{
pData->curElement = ELEMENT_LIST;
wcscpy( gIMPVoice[pData->curIndex].szVoiceSetName, pData->curIMPVoice.szVoiceSetName );
gIMPVoice[pData->curIndex].voiceset = pData->curIMPVoice.voiceset;
gIMPVoice[pData->curIndex].bSex = pData->curIMPVoice.bSex;
gIMPVoice[pData->curIndex].exists = TRUE;
pData->curIMPVoice.exists = TRUE;
gIMPVoice.push_back( pData->curIMPVoice );
++pData->curIndex;
}