mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
- There can now be effectively unlimited battle sounds for NPCs.
- Activated some NPC voices that never played. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20659&goto=360457&#msg_360457 GameDir >= r2554 is recommended. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8829 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -265,6 +265,19 @@ BATTLESNDS_STRUCT gBattleSndsData[] =
|
|||||||
"knife", 1, 0, 0, 0,
|
"knife", 1, 0, 0, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Flugente: a little helper struct for npc sounds
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
CHAR8 zName[20];
|
||||||
|
} BATTLESNDS_NPC_HELPER_STRUCT;
|
||||||
|
|
||||||
|
BATTLESNDS_NPC_HELPER_STRUCT gBattleSndsNpcHelperData[] =
|
||||||
|
{
|
||||||
|
"bad",
|
||||||
|
"kid",
|
||||||
|
"zombie",
|
||||||
|
};
|
||||||
|
|
||||||
extern void ReduceAttachmentsOnGunForNonPlayerChars( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj );
|
extern void ReduceAttachmentsOnGunForNonPlayerChars( SOLDIERTYPE *pSoldier, OBJECTTYPE * pObj );
|
||||||
|
|
||||||
// CHRISL:
|
// CHRISL:
|
||||||
@@ -10904,6 +10917,12 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr
|
|||||||
|
|
||||||
extern BOOLEAN IsMercSayingDialogue( UINT8 ubProfileID );
|
extern BOOLEAN IsMercSayingDialogue( UINT8 ubProfileID );
|
||||||
|
|
||||||
|
// Flugente: store how many sounds we've found for each npc type
|
||||||
|
#define BATTLESOUND_NPC_TYPES 3
|
||||||
|
#define BATTLESOUND_NPC_SOUNDSETS 8
|
||||||
|
UINT32 numBattleSounds_Npc[BATTLESOUND_NPC_TYPES][BATTLESOUND_NPC_SOUNDSETS][NUM_MERC_BATTLE_SOUNDS];
|
||||||
|
bool BattleSoundSearchDone_Npc[BATTLESOUND_NPC_TYPES][BATTLESOUND_NPC_SOUNDSETS][NUM_MERC_BATTLE_SOUNDS];
|
||||||
|
|
||||||
BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpecialCode )
|
BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpecialCode )
|
||||||
{
|
{
|
||||||
//in this function, pSoldier stands in for the this pointer, since
|
//in this function, pSoldier stands in for the this pointer, since
|
||||||
@@ -11228,47 +11247,50 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV )
|
int entrynum = 0;
|
||||||
|
if ( pSoldier->IsZombie() ) // Madd: add zombie sounds
|
||||||
{
|
{
|
||||||
if ( ubSoundID == BATTLE_SOUND_DIE1 )
|
entrynum = 2;
|
||||||
|
pSoldier->ubBattleSoundID = 0; // atm only one soundset for zombies
|
||||||
|
}
|
||||||
|
else if ( pSoldier->ubBodyType == HATKIDCIV || pSoldier->ubBodyType == KIDCIV )
|
||||||
|
entrynum = 1;
|
||||||
|
|
||||||
|
// Flugente: check if perhaps a sound with a higher number is present, if so, increase number of found sounds
|
||||||
|
// if not, mark that this search is finished (no need to constantly check for sounds)
|
||||||
|
// This way we don't have to add new xml data, but can still use any soundfile we add (provided we numbered it correctly)
|
||||||
|
// Soundfiles are named just like before, with increasing numbers
|
||||||
|
// There are three categories for npc sound files here: bad (for ordinary humans), kid for kids and zombie
|
||||||
|
// Due to legacy reasons, the first sound can either have a '1' at the end (212_OK1.xx) or no number at all (212_HUMM.xxx)
|
||||||
|
// Otherwise we'd have to rename quite a lot of vanilla files
|
||||||
|
while ( !BattleSoundSearchDone_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID] )
|
||||||
|
{
|
||||||
|
// at least one sound exists (if not, we use a fallback solution anyway)
|
||||||
|
numBattleSounds_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID] = max( 1, numBattleSounds_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID] );
|
||||||
|
|
||||||
|
UINT32 numsounds = numBattleSounds_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID];
|
||||||
|
|
||||||
|
// check: is there a sound with a bigger number?
|
||||||
|
sprintf( zFilename, "BATTLESNDS\\%s%d_%s%d", gBattleSndsNpcHelperData[entrynum].zName, pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName, numsounds + 1 );
|
||||||
|
|
||||||
|
if ( SoundFileExists( zFilename, zFilename_Used ) )
|
||||||
{
|
{
|
||||||
sprintf( zFilename, "BATTLESNDS\\kid%d_dying", pSoldier->ubBattleSoundID );
|
numBattleSounds_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID]++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf( zFilename, "BATTLESNDS\\kid%d_%s1", pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName );
|
BattleSoundSearchDone_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID] = true;
|
||||||
|
|
||||||
if ( !SoundFileExists( zFilename, zFilename_Used ) )
|
|
||||||
sprintf( zFilename, "BATTLESNDS\\kid%d_%s2", pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( pSoldier->IsZombie( ) ) // Madd: add zombie sounds
|
|
||||||
{
|
|
||||||
if ( ubSoundID == BATTLE_SOUND_DIE1 )
|
|
||||||
{
|
|
||||||
sprintf( zFilename, "BATTLESNDS\\zombie_die" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf( zFilename, "BATTLESNDS\\zombie_%s1", gBattleSndsData[ubSoundID].zName );
|
|
||||||
|
|
||||||
if ( !SoundFileExists( zFilename, zFilename_Used ) )
|
UINT16 soundtoplay = 1 + Random( numBattleSounds_Npc[entrynum][pSoldier->ubBattleSoundID][ubSoundID] );
|
||||||
sprintf( zFilename, "BATTLESNDS\\zombie_%s2", gBattleSndsData[ubSoundID].zName );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( ubSoundID == BATTLE_SOUND_DIE1 )
|
|
||||||
{
|
|
||||||
sprintf( zFilename, "BATTLESNDS\\bad%d_die", pSoldier->ubBattleSoundID );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf( zFilename, "BATTLESNDS\\bad%d_%s1", pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName );
|
|
||||||
|
|
||||||
if ( !SoundFileExists( zFilename, zFilename_Used ) )
|
sprintf( zFilename, "BATTLESNDS\\%s%d_%s%d", gBattleSndsNpcHelperData[entrynum].zName, pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName, soundtoplay );
|
||||||
sprintf( zFilename, "BATTLESNDS\\bad%d_%s2", pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName );
|
|
||||||
}
|
// due to legacy reasons, we both have to check for versions with '1' and without a number here
|
||||||
|
if ( !SoundFileExists( zFilename, zFilename_Used ) )
|
||||||
|
{
|
||||||
|
sprintf( zFilename, "BATTLESNDS\\%s%d_%s", gBattleSndsNpcHelperData[entrynum].zName, pSoldier->ubBattleSoundID, gBattleSndsData[ubSoundID].zName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -938,13 +938,6 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
|||||||
} // otherwise (creatures) false
|
} // otherwise (creatures) false
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK, If not given a profile num, set a randomized defualt battle sound set
|
|
||||||
// and then adjust it according to body type!
|
|
||||||
if ( Soldier.ubProfile == NO_PROFILE )
|
|
||||||
{
|
|
||||||
Soldier.ubBattleSoundID = (UINT8)Random( 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// WANNE: Extnernalized!
|
// WANNE: Extnernalized!
|
||||||
// ATE: TEMP : No enemy women mercs (unless elite)!
|
// ATE: TEMP : No enemy women mercs (unless elite)!
|
||||||
if (gGameExternalOptions.fRestrictFemaleEnemiesExceptElite == TRUE)
|
if (gGameExternalOptions.fRestrictFemaleEnemiesExceptElite == TRUE)
|
||||||
@@ -1021,6 +1014,15 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// OK, If not given a profile num, set a randomized default battle sound set
|
||||||
|
// and then adjust it according to body type!
|
||||||
|
if ( Soldier.ubProfile == NO_PROFILE )
|
||||||
|
{
|
||||||
|
// default (men) badguy battlesound sets 0-5
|
||||||
|
Soldier.ubBattleSoundID = (UINT8)Random( 6 );
|
||||||
|
}
|
||||||
|
|
||||||
//Set some flags, actions based on what body type we are
|
//Set some flags, actions based on what body type we are
|
||||||
//NOTE: BE VERY CAREFUL WHAT YOU DO IN THIS SECTION!
|
//NOTE: BE VERY CAREFUL WHAT YOU DO IN THIS SECTION!
|
||||||
// It is very possible to override editor settings, especially orders and attitude.
|
// It is very possible to override editor settings, especially orders and attitude.
|
||||||
@@ -1029,7 +1031,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
|||||||
{
|
{
|
||||||
case HATKIDCIV:
|
case HATKIDCIV:
|
||||||
case KIDCIV:
|
case KIDCIV:
|
||||||
|
// kids have 2 battlesound sets
|
||||||
Soldier.ubBattleSoundID = (UINT8)Random( 2 );
|
Soldier.ubBattleSoundID = (UINT8)Random( 2 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1037,7 +1039,8 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
|||||||
case MINICIV:
|
case MINICIV:
|
||||||
case DRESSCIV:
|
case DRESSCIV:
|
||||||
|
|
||||||
Soldier.ubBattleSoundID = 7 + (UINT8) Random( 2 );
|
// women get badguy battlesound sets 6-11
|
||||||
|
Soldier.ubBattleSoundID = 6 + (UINT8) Random( 6 );
|
||||||
Soldier.aiData.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH;
|
Soldier.aiData.bNormalSmell = NORMAL_HUMAN_SMELL_STRENGTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user