Removed Sounds/SoundsProfiles.xml and relevant code. If you don't want soundfiles to play for a character, remove or rename those soundfiles, no need for an extra xml.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8623 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2018-09-29 15:06:37 +00:00
parent 0905d5aa47
commit 487c21ffdf
14 changed files with 40 additions and 306 deletions
-6
View File
@@ -1159,12 +1159,6 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
} }
} }
//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 //Random stats by jazz
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, RANDOMSTATS); strcat(fileName, RANDOMSTATS);
+28 -51
View File
@@ -94,8 +94,6 @@ class SOLDIERTYPE;
#define DIALOGUE_DEFAULT_SUBTITLE_WIDTH 200 #define DIALOGUE_DEFAULT_SUBTITLE_WIDTH 200
#define TEXT_DELAY_MODIFIER 60 #define TEXT_DELAY_MODIFIER 60
SOUND_PROFILE_VALUES gSoundProfileValue[NUM_PROFILES];
typedef struct typedef struct
{ {
UINT16 usQuoteNum; UINT16 usQuoteNum;
@@ -2320,17 +2318,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN
{ {
if ( fWavFile ) if ( fWavFile )
{ {
// Lesh: patch to allow playback ogg speech files sprintf( zFileNameHelper, "NPC_SPEECH\\d_%03d_%03d", usVoiceSet, usQuoteNum );
// 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
} }
else else
{ {
@@ -2388,17 +2376,14 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN
if ( fWavFile ) if ( fWavFile )
{ {
if ( gSoundProfileValue[ubFileNumID].EnabledSound == TRUE ) // Lesh: patch to allow playback ogg speech files
{ sprintf( zFileNameHelper, "NPC_SPEECH\\%03d_%03d", ubFileNumID, usQuoteNum );
// 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 // 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 ) ) if ( isBartenderSantos && HERVE != ubFileNumID && !SoundFileExists( zFileNameHelper, zFileName ) )
{ {
ubFileNumID = HERVE; ubFileNumID = HERVE;
sprintf( zFileNameHelper,"NPC_SPEECH\\%03d_%03d",ubFileNumID,usQuoteNum ); sprintf( zFileNameHelper, "NPC_SPEECH\\%03d_%03d", ubFileNumID, usQuoteNum );
}
} }
} }
else else
@@ -2423,28 +2408,23 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN
gMercProfiles[ubCharacterNum].Type == PROFILETYPE_VEHICLE ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) 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 ); //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 );
#else
sprintf( zFileNameHelper,"SPEECH\\r_%03d_%03d",usVoiceSet,usQuoteNum );
//<SB> Also check for Russian Gold sound files (identical to international ones) #ifdef JA2UB
if ( !SoundFileExists( zFileNameHelper, zFileName ) ) //inshy: fix for UB-1.13 version only
sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); sprintf( zFileNameHelper,"SPEECH\\%03d_%03d",usVoiceSet,usQuoteNum );
#else
sprintf( zFileNameHelper,"SPEECH\\r_%03d_%03d",usVoiceSet,usQuoteNum );
//<SB> Also check for Russian Gold sound files (identical to international ones)
if ( !SoundFileExists( zFileNameHelper, zFileName ) )
sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum );
#endif #endif
}
} }
else else
#endif #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 else
@@ -2470,20 +2450,17 @@ CHAR8 *GetSnitchDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, B
if ( fWavFile ) if ( fWavFile )
{ {
if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE ) // build name of wav file (characternum + quotenum)
if ( fName )
{ {
// build name of wav file (characternum + quotenum) sprintf( zFileName, "SPEECH\\SNITCH\\NAMES\\%03d_%03d", usVoiceSet, usQuoteNum );
if(fName)
{
sprintf( zFileName, "SPEECH\\SNITCH\\NAMES\\%03d_%03d", usVoiceSet, usQuoteNum );
}
else
{
sprintf( zFileName, "SPEECH\\SNITCH\\%03d_%03d", usVoiceSet, usQuoteNum );
}
SoundFileExists( zFileName, zFilename_Used );
} }
else
{
sprintf( zFileName, "SPEECH\\SNITCH\\%03d_%03d", usVoiceSet, usQuoteNum );
}
SoundFileExists( zFileName, zFilename_Used );
} }
else else
{ {
-9
View File
@@ -6,15 +6,6 @@
#include "soldier profile type.h" #include "soldier profile type.h"
#include <vector> #include <vector>
typedef struct
{
UINT16 uiIndex; // add
BOOLEAN EnabledSound;
} SOUND_PROFILE_VALUES;
extern SOUND_PROFILE_VALUES gSoundProfileValue[NUM_PROFILES];
// An enumeration for dialog quotes // An enumeration for dialog quotes
enum DialogQuoteIDs enum DialogQuoteIDs
{ {
+14 -17
View File
@@ -11020,26 +11020,23 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
spParms.uiPan = SoundDir( pSoldier->sGridNo ); spParms.uiPan = SoundDir( pSoldier->sGridNo );
spParms.uiPriority = GROUP_PLAYER; 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);
{ }
return(FALSE); else
} {
else pSoldier->uiBattleSoundID = uiSoundID;
{
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 ExternSetFaceTalking( iFaceIndex, uiSoundID );
iFaceIndex = pSoldier->iFaceIndex;
// Check face index
if ( iFaceIndex != -1 )
{
ExternSetFaceTalking( iFaceIndex, uiSoundID );
}
} }
} }
} }
-4
View File
@@ -1244,10 +1244,6 @@
RelativePath=".\XML_SoldierProfiles.cpp" RelativePath=".\XML_SoldierProfiles.cpp"
> >
</File> </File>
<File
RelativePath=".\XML_SoundProfile.cpp"
>
</File>
<File <File
RelativePath=".\XML_Sounds.cpp" RelativePath=".\XML_Sounds.cpp"
> >
-4
View File
@@ -1246,10 +1246,6 @@
RelativePath=".\XML_SoldierProfiles.cpp" RelativePath=".\XML_SoldierProfiles.cpp"
> >
</File> </File>
<File
RelativePath=".\XML_SoundProfile.cpp"
>
</File>
<File <File
RelativePath="XML_Sounds.cpp" RelativePath="XML_Sounds.cpp"
> >
-1
View File
@@ -248,7 +248,6 @@
<ClCompile Include="XML_RPCFacesSmall.cpp" /> <ClCompile Include="XML_RPCFacesSmall.cpp" />
<ClCompile Include="XML_SectorLoadscreens.cpp" /> <ClCompile Include="XML_SectorLoadscreens.cpp" />
<ClCompile Include="XML_SoldierProfiles.cpp" /> <ClCompile Include="XML_SoldierProfiles.cpp" />
<ClCompile Include="XML_SoundProfile.cpp" />
<ClCompile Include="XML_Sounds.cpp" /> <ClCompile Include="XML_Sounds.cpp" />
<ClCompile Include="XML_SpreadPatterns.cpp" /> <ClCompile Include="XML_SpreadPatterns.cpp" />
<ClCompile Include="XML_StructureConstruct.cpp" /> <ClCompile Include="XML_StructureConstruct.cpp" />
-3
View File
@@ -620,9 +620,6 @@
<ClCompile Include="XML_RandomStats.cpp"> <ClCompile Include="XML_RandomStats.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="XML_SoundProfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="XML_Qarray.cpp"> <ClCompile Include="XML_Qarray.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
-1
View File
@@ -249,7 +249,6 @@
<ClCompile Include="XML_RPCFacesSmall.cpp" /> <ClCompile Include="XML_RPCFacesSmall.cpp" />
<ClCompile Include="XML_SectorLoadscreens.cpp" /> <ClCompile Include="XML_SectorLoadscreens.cpp" />
<ClCompile Include="XML_SoldierProfiles.cpp" /> <ClCompile Include="XML_SoldierProfiles.cpp" />
<ClCompile Include="XML_SoundProfile.cpp" />
<ClCompile Include="XML_Sounds.cpp" /> <ClCompile Include="XML_Sounds.cpp" />
<ClCompile Include="XML_SpreadPatterns.cpp" /> <ClCompile Include="XML_SpreadPatterns.cpp" />
<ClCompile Include="XML_StructureConstruct.cpp" /> <ClCompile Include="XML_StructureConstruct.cpp" />
-3
View File
@@ -623,9 +623,6 @@
<ClCompile Include="XML_RandomStats.cpp"> <ClCompile Include="XML_RandomStats.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="XML_SoundProfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="XML_Qarray.cpp"> <ClCompile Include="XML_Qarray.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
-1
View File
@@ -249,7 +249,6 @@
<ClCompile Include="XML_RPCFacesSmall.cpp" /> <ClCompile Include="XML_RPCFacesSmall.cpp" />
<ClCompile Include="XML_SectorLoadscreens.cpp" /> <ClCompile Include="XML_SectorLoadscreens.cpp" />
<ClCompile Include="XML_SoldierProfiles.cpp" /> <ClCompile Include="XML_SoldierProfiles.cpp" />
<ClCompile Include="XML_SoundProfile.cpp" />
<ClCompile Include="XML_Sounds.cpp" /> <ClCompile Include="XML_Sounds.cpp" />
<ClCompile Include="XML_SpreadPatterns.cpp" /> <ClCompile Include="XML_SpreadPatterns.cpp" />
<ClCompile Include="XML_StructureConstruct.cpp" /> <ClCompile Include="XML_StructureConstruct.cpp" />
-3
View File
@@ -623,9 +623,6 @@
<ClCompile Include="XML_RandomStats.cpp"> <ClCompile Include="XML_RandomStats.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="XML_SoundProfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="XML_Qarray.cpp"> <ClCompile Include="XML_Qarray.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
-5
View File
@@ -148,7 +148,6 @@ typedef PARSE_STAGE;
#define SOUNDSFILENAME "Sounds\\Sounds.xml" #define SOUNDSFILENAME "Sounds\\Sounds.xml"
#define BURSTSOUNDSFILENAME "Sounds\\BurstSounds.xml" #define BURSTSOUNDSFILENAME "Sounds\\BurstSounds.xml"
#define SOUNDPROFILE "Sounds\\SoundsProfiles.xml"
#define SECTORLOADSCREENSFILENAME "Map\\SectorLoadscreens.xml" #define SECTORLOADSCREENSFILENAME "Map\\SectorLoadscreens.xml"
#define CITYTABLEFILENAME "Map\\Cities.xml" #define CITYTABLEFILENAME "Map\\Cities.xml"
@@ -525,10 +524,6 @@ extern BOOLEAN WriteLocks( STR fileName );
extern BOOLEAN ReadInKeys( STR fileName ); extern BOOLEAN ReadInKeys( STR fileName );
extern BOOLEAN WriteKeys( 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 //Random stats by Jazz
extern BOOLEAN WriteRandomStats( STR fileName ); extern BOOLEAN WriteRandomStats( STR fileName );
extern BOOLEAN ReadInRandomStats( STR fileName ); extern BOOLEAN ReadInRandomStats( STR fileName );
-200
View File
@@ -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,"<SOUNDPROFILE>\r\n");
for(cnt = 0;cnt < NUM_PROFILES;cnt++)
{
FilePrintf(hFile,"\t<PROFILE>\r\n");
FilePrintf(hFile,"\t\t<uiIndex>%d</uiIndex>\r\n", cnt);
FilePrintf(hFile,"\t\t<EnabledSound>1</EnabledSound>\r\n");
FilePrintf(hFile,"\t</PROFILE>\r\n");
}
FilePrintf(hFile,"</SOUNDPROFILE>\r\n");
}
FileClose( hFile );
return( TRUE );
}