diff --git a/Init.cpp b/Init.cpp index 32cafee9..7a904fd1 100644 --- a/Init.cpp +++ b/Init.cpp @@ -1158,12 +1158,6 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) num_found_soldier_profiles[5] = num_found_profiles; } } - - //Sound profile by jazz - strcpy(fileName, directoryName); - strcat(fileName, SOUNDPROFILE); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); - SGP_THROW_IFFALSE(ReadInSoundProfile(fileName), SOUNDPROFILE); //Random stats by jazz strcpy(fileName, directoryName); diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 93953b9f..7a10da12 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -94,8 +94,6 @@ class SOLDIERTYPE; #define DIALOGUE_DEFAULT_SUBTITLE_WIDTH 200 #define TEXT_DELAY_MODIFIER 60 -SOUND_PROFILE_VALUES gSoundProfileValue[NUM_PROFILES]; - typedef struct { UINT16 usQuoteNum; @@ -2320,17 +2318,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN { if ( fWavFile ) { - // Lesh: patch to allow playback ogg speech files - // build name of wav file (characternum + quotenum) -//SB: curiously, there are no g_%03d_%03d audio files in all russian versions -// #ifdef RUSSIAN -// sprintf( zFileNameHelper,"NPC_SPEECH\\g_%03d_%03d",ubCharacterNum,usQuoteNum ); -// #else - if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE ) - { - sprintf( zFileNameHelper, "NPC_SPEECH\\d_%03d_%03d", usVoiceSet, usQuoteNum ); - } -// #endif + sprintf( zFileNameHelper, "NPC_SPEECH\\d_%03d_%03d", usVoiceSet, usQuoteNum ); } else { @@ -2388,17 +2376,14 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN if ( fWavFile ) { - if ( gSoundProfileValue[ubFileNumID].EnabledSound == TRUE ) + // Lesh: patch to allow playback ogg speech files + sprintf( zFileNameHelper, "NPC_SPEECH\\%03d_%03d", ubFileNumID, usQuoteNum ); + + // WANNE: We do not have any speech files for the other (!= HERVE) santos bartenders, take HERVE speech files + if ( isBartenderSantos && HERVE != ubFileNumID && !SoundFileExists( zFileNameHelper, zFileName ) ) { - // Lesh: patch to allow playback ogg speech files - sprintf( zFileNameHelper,"NPC_SPEECH\\%03d_%03d",ubFileNumID,usQuoteNum ); - - // WANNE: We do not have any speech files for the other (!= HERVE) santos bartenders, take HERVE speech files - if (isBartenderSantos && HERVE != ubFileNumID && !SoundFileExists( zFileNameHelper, zFileName ) ) - { - ubFileNumID = HERVE; - sprintf( zFileNameHelper,"NPC_SPEECH\\%03d_%03d",ubFileNumID,usQuoteNum ); - } + ubFileNumID = HERVE; + sprintf( zFileNameHelper, "NPC_SPEECH\\%03d_%03d", ubFileNumID, usQuoteNum ); } } else @@ -2423,28 +2408,23 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN 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 ) - { + #ifdef JA2UB - //inshy: fix for UB-1.13 version only - sprintf( zFileNameHelper,"SPEECH\\%03d_%03d",usVoiceSet,usQuoteNum ); + //inshy: fix for UB-1.13 version only + sprintf( zFileNameHelper,"SPEECH\\%03d_%03d",usVoiceSet,usQuoteNum ); #else - sprintf( zFileNameHelper,"SPEECH\\r_%03d_%03d",usVoiceSet,usQuoteNum ); + sprintf( zFileNameHelper,"SPEECH\\r_%03d_%03d",usVoiceSet,usQuoteNum ); - // Also check for Russian Gold sound files (identical to international ones) - if ( !SoundFileExists( zFileNameHelper, zFileName ) ) - sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); + // Also check for Russian Gold sound files (identical to international ones) + if ( !SoundFileExists( zFileNameHelper, zFileName ) ) + sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); #endif - } } else #endif { - if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE ) - { - // build name of wav file (characternum + quotenum) - sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); - } + // build name of wav file (characternum + quotenum) + sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); } } else @@ -2470,20 +2450,17 @@ CHAR8 *GetSnitchDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, B if ( fWavFile ) { - if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE ) + // build name of wav file (characternum + quotenum) + if ( fName ) { - // build name of wav file (characternum + quotenum) - if(fName) - { - sprintf( zFileName, "SPEECH\\SNITCH\\NAMES\\%03d_%03d", usVoiceSet, usQuoteNum ); - } - else - { - sprintf( zFileName, "SPEECH\\SNITCH\\%03d_%03d", usVoiceSet, usQuoteNum ); - } - - SoundFileExists( zFileName, zFilename_Used ); + sprintf( zFileName, "SPEECH\\SNITCH\\NAMES\\%03d_%03d", usVoiceSet, usQuoteNum ); } + else + { + sprintf( zFileName, "SPEECH\\SNITCH\\%03d_%03d", usVoiceSet, usQuoteNum ); + } + + SoundFileExists( zFileName, zFilename_Used ); } else { diff --git a/Tactical/Dialogue Control.h b/Tactical/Dialogue Control.h index 6cd3c6d6..bec5e32a 100644 --- a/Tactical/Dialogue Control.h +++ b/Tactical/Dialogue Control.h @@ -6,15 +6,6 @@ #include "soldier profile type.h" #include -typedef struct -{ - UINT16 uiIndex; // add - BOOLEAN EnabledSound; - -} SOUND_PROFILE_VALUES; - -extern SOUND_PROFILE_VALUES gSoundProfileValue[NUM_PROFILES]; - // An enumeration for dialog quotes enum DialogQuoteIDs { diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index b5c13fc4..36444af8 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -11020,26 +11020,23 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe spParms.uiPan = SoundDir( pSoldier->sGridNo ); spParms.uiPriority = GROUP_PLAYER; - if ( gSoundProfileValue[pSoldier->ubProfile].EnabledSound == TRUE || pSoldier->ubProfile == NO_PROFILE ) + if ( (uiSoundID = SoundPlay( zFilename_Used, &spParms )) == SOUND_ERROR ) { - if ( (uiSoundID = SoundPlay( zFilename_Used, &spParms )) == SOUND_ERROR ) - { - return(FALSE); - } - else - { - pSoldier->uiBattleSoundID = uiSoundID; + return(FALSE); + } + else + { + pSoldier->uiBattleSoundID = uiSoundID; - if ( pSoldier->ubProfile != NO_PROFILE ) + if ( pSoldier->ubProfile != NO_PROFILE ) + { + // Get soldier's face ID + iFaceIndex = pSoldier->iFaceIndex; + + // Check face index + if ( iFaceIndex != -1 ) { - // Get soldier's face ID - iFaceIndex = pSoldier->iFaceIndex; - - // Check face index - if ( iFaceIndex != -1 ) - { - ExternSetFaceTalking( iFaceIndex, uiSoundID ); - } + ExternSetFaceTalking( iFaceIndex, uiSoundID ); } } } diff --git a/Tactical/Tactical_VS2005.vcproj b/Tactical/Tactical_VS2005.vcproj index ed2e538d..b74e3b27 100644 --- a/Tactical/Tactical_VS2005.vcproj +++ b/Tactical/Tactical_VS2005.vcproj @@ -1244,10 +1244,6 @@ RelativePath=".\XML_SoldierProfiles.cpp" > - - diff --git a/Tactical/Tactical_VS2008.vcproj b/Tactical/Tactical_VS2008.vcproj index 4cdf15e0..65dc7bb5 100644 --- a/Tactical/Tactical_VS2008.vcproj +++ b/Tactical/Tactical_VS2008.vcproj @@ -1246,10 +1246,6 @@ RelativePath=".\XML_SoldierProfiles.cpp" > - - diff --git a/Tactical/Tactical_VS2010.vcxproj b/Tactical/Tactical_VS2010.vcxproj index 7c477e8a..f4502dcc 100644 --- a/Tactical/Tactical_VS2010.vcxproj +++ b/Tactical/Tactical_VS2010.vcxproj @@ -248,7 +248,6 @@ - diff --git a/Tactical/Tactical_VS2010.vcxproj.filters b/Tactical/Tactical_VS2010.vcxproj.filters index 8f3a055c..b7c82e98 100644 --- a/Tactical/Tactical_VS2010.vcxproj.filters +++ b/Tactical/Tactical_VS2010.vcxproj.filters @@ -620,9 +620,6 @@ Source Files - - Source Files - Source Files diff --git a/Tactical/Tactical_VS2013.vcxproj b/Tactical/Tactical_VS2013.vcxproj index 6cf94a47..770f41a7 100644 --- a/Tactical/Tactical_VS2013.vcxproj +++ b/Tactical/Tactical_VS2013.vcxproj @@ -249,7 +249,6 @@ - diff --git a/Tactical/Tactical_VS2013.vcxproj.filters b/Tactical/Tactical_VS2013.vcxproj.filters index 7a3ff08a..15c9b3a3 100644 --- a/Tactical/Tactical_VS2013.vcxproj.filters +++ b/Tactical/Tactical_VS2013.vcxproj.filters @@ -623,9 +623,6 @@ Source Files - - Source Files - Source Files diff --git a/Tactical/Tactical_VS2017.vcxproj b/Tactical/Tactical_VS2017.vcxproj index 10b472c3..b1e56e8a 100644 --- a/Tactical/Tactical_VS2017.vcxproj +++ b/Tactical/Tactical_VS2017.vcxproj @@ -249,7 +249,6 @@ - diff --git a/Tactical/Tactical_VS2017.vcxproj.filters b/Tactical/Tactical_VS2017.vcxproj.filters index 7a3ff08a..15c9b3a3 100644 --- a/Tactical/Tactical_VS2017.vcxproj.filters +++ b/Tactical/Tactical_VS2017.vcxproj.filters @@ -623,9 +623,6 @@ Source Files - - Source Files - Source Files diff --git a/Tactical/XML.h b/Tactical/XML.h index beeee8bd..4a0c89ae 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -148,7 +148,6 @@ typedef PARSE_STAGE; #define SOUNDSFILENAME "Sounds\\Sounds.xml" #define BURSTSOUNDSFILENAME "Sounds\\BurstSounds.xml" -#define SOUNDPROFILE "Sounds\\SoundsProfiles.xml" #define SECTORLOADSCREENSFILENAME "Map\\SectorLoadscreens.xml" #define CITYTABLEFILENAME "Map\\Cities.xml" @@ -525,10 +524,6 @@ extern BOOLEAN WriteLocks( STR fileName ); extern BOOLEAN ReadInKeys( STR fileName ); extern BOOLEAN WriteKeys( STR fileName ); -//Enabled\Disabled profile sound by Jazz -extern BOOLEAN ReadInSoundProfile( STR fileName ); -extern BOOLEAN WriteSoundProfile( STR fileName ); - //Random stats by Jazz extern BOOLEAN WriteRandomStats( STR fileName ); extern BOOLEAN ReadInRandomStats( STR fileName ); diff --git a/Tactical/XML_SoundProfile.cpp b/Tactical/XML_SoundProfile.cpp deleted file mode 100644 index e6fd46bc..00000000 --- a/Tactical/XML_SoundProfile.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#ifdef PRECOMPILEDHEADERS - #include "Tactical All.h" -#else - #include "sgp.h" - #include "Debug Control.h" - #include "expat.h" - #include "XML.h" -#endif - -#include "Dialogue Control.h" -#include "soldier profile type.h" - -struct -{ - PARSE_STAGE curElement; - - CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - SOUND_PROFILE_VALUES curSoundProfile; - SOUND_PROFILE_VALUES * curArray; - - UINT32 maxArraySize; - UINT32 curIndex; - UINT32 currentDepth; - UINT32 maxReadDepth; -} -typedef SoundProfileParseData; - -static void XMLCALL -SoundProfileStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) -{ - SoundProfileParseData * pData = (SoundProfileParseData *)userData; - - if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? - { - if(strcmp(name, "SOUNDPROFILE") == 0 && pData->curElement == ELEMENT_NONE) - { - pData->curElement = ELEMENT_LIST; - - pData->maxReadDepth++; //we are not skipping this element - } - else if(strcmp(name, "PROFILE") == 0 && pData->curElement == ELEMENT_LIST) - { - pData->curElement = ELEMENT; - - pData->maxReadDepth++; //we are not skipping this element - } - else if(pData->curElement == ELEMENT && - (strcmp(name, "uiIndex") == 0 || - strcmp(name, "EnabledSound") == 0 )) - { - pData->curElement = ELEMENT_PROPERTY; - - pData->maxReadDepth++; //we are not skipping this element - } - - pData->szCharData[0] = '\0'; - } - - pData->currentDepth++; - -} - -static void XMLCALL -SoundProfileCharacterDataHandle(void *userData, const XML_Char *str, int len) -{ - SoundProfileParseData * pData = (SoundProfileParseData *)userData; - - if( (pData->currentDepth <= pData->maxReadDepth) && - (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ - strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } -} - - -static void XMLCALL -SoundProfileEndElementHandle(void *userData, const XML_Char *name) -{ - SoundProfileParseData * pData = (SoundProfileParseData *)userData; - - if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading - { - if(strcmp(name, "SOUNDPROFILE") == 0) - { - pData->curElement = ELEMENT_NONE; - } - else if(strcmp(name, "PROFILE") == 0) - { - pData->curElement = ELEMENT_LIST; - - gSoundProfileValue[pData->curSoundProfile.uiIndex].EnabledSound = pData->curSoundProfile.EnabledSound; - } - else if(strcmp(name, "uiIndex") == 0) - { - pData->curElement = ELEMENT; - pData->curSoundProfile.uiIndex = (UINT16) atol(pData->szCharData); - } - else if(strcmp(name, "EnabledSound") == 0) - { - pData->curElement = ELEMENT; - pData->curSoundProfile.EnabledSound = (BOOLEAN) atol(pData->szCharData); - } - pData->maxReadDepth--; - } - - pData->currentDepth--; -} - - - - -BOOLEAN ReadInSoundProfile(STR fileName) -{ - HWFILE hFile; - UINT32 uiBytesRead; - UINT32 uiFSize; - CHAR8 * lpcBuffer; - XML_Parser parser = XML_ParserCreate(NULL); - - SoundProfileParseData pData; - - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading SoundsProfiles.xml" ); - - // Open file - hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); - if ( !hFile ) - return( FALSE ); - - uiFSize = FileGetSize(hFile); - lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); - - //Read in block - if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) - { - MemFree(lpcBuffer); - return( FALSE ); - } - - lpcBuffer[uiFSize] = 0; //add a null terminator - - FileClose( hFile ); - - - XML_SetElementHandler(parser, SoundProfileStartElementHandle, SoundProfileEndElementHandle); - XML_SetCharacterDataHandler(parser, SoundProfileCharacterDataHandle); - - - memset(&pData,0,sizeof(pData)); - XML_SetUserData(parser, &pData); - - - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) - { - CHAR8 errorBuf[511]; - - sprintf(errorBuf, "XML Parser Error in SoundsProfiles.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); - LiveMessage(errorBuf); - - MemFree(lpcBuffer); - return FALSE; - } - - MemFree(lpcBuffer); - - - XML_ParserFree(parser); - - - return( TRUE ); -} - -BOOLEAN WriteSoundProfile(STR fileName) -{ - HWFILE hFile; - - //Debug code; make sure that what we got from the file is the same as what's there - // Open a new file - hFile = FileOpen( fileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); - if ( !hFile ) - return( FALSE ); - - { - UINT32 cnt; - - FilePrintf(hFile,"\r\n"); - for(cnt = 0;cnt < NUM_PROFILES;cnt++) - { - - FilePrintf(hFile,"\t\r\n"); - - FilePrintf(hFile,"\t\t%d\r\n", cnt); - FilePrintf(hFile,"\t\t1\r\n"); - FilePrintf(hFile,"\t\r\n"); - } - FilePrintf(hFile,"\r\n"); - } - FileClose( hFile ); - - return( TRUE ); -} \ No newline at end of file