mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Merged New Inventory Project into main branch
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+247
-246
@@ -13,7 +13,7 @@
|
||||
#include "math.h"
|
||||
#endif
|
||||
|
||||
#define SOUND_FAR_VOLUME_MOD 25
|
||||
#define SOUND_FAR_VOLUME_MOD 25
|
||||
|
||||
/*
|
||||
UINT32 LOWVOLUME START_LOWVOLUME;
|
||||
@@ -103,7 +103,7 @@ char szSoundEffects[MAX_SAMPLES][255];// =
|
||||
// "SOUNDS\\BULLET IMPACT 02.WAV",
|
||||
//
|
||||
// "STSOUNDS\\BLAH.WAV", // CREATURE ATTACK
|
||||
//
|
||||
//
|
||||
// "SOUNDS\\STEP INTO WATER.WAV",
|
||||
// "SOUNDS\\SPLASH FROM SHALLOW TO DEEP.WAV",
|
||||
//
|
||||
@@ -142,14 +142,14 @@ char szSoundEffects[MAX_SAMPLES][255];// =
|
||||
// "SOUNDS\\STONE IMPACT 01.WAV",
|
||||
// "SOUNDS\\WATER IMPACT 01.WAV",
|
||||
// "SOUNDS\\VEG IMPACT 01.WAV",
|
||||
// "SOUNDS\\METAL HIT 01.WAV", // S_METAL_HIT1
|
||||
// "SOUNDS\\METAL HIT 01.WAV",
|
||||
// "SOUNDS\\METAL HIT 01.WAV",
|
||||
// "SOUNDS\\METAL HIT 01.WAV", // S_METAL_HIT1
|
||||
// "SOUNDS\\METAL HIT 01.WAV",
|
||||
// "SOUNDS\\METAL HIT 01.WAV",
|
||||
//
|
||||
// "SOUNDS\\SLAP_IMPACT.WAV",
|
||||
//
|
||||
// // FIREARM RELOAD
|
||||
// "SOUNDS\\WEAPONS\\REVOLVER RELOAD.WAV", // REVOLVER
|
||||
// "SOUNDS\\WEAPONS\\REVOLVER RELOAD.WAV", // REVOLVER
|
||||
// "SOUNDS\\WEAPONS\\PISTOL RELOAD.WAV", // PISTOL
|
||||
// "SOUNDS\\WEAPONS\\SMG RELOAD.WAV", // SMG
|
||||
// "SOUNDS\\WEAPONS\\RIFLE RELOAD.WAV", // RIFLE
|
||||
@@ -157,7 +157,7 @@ char szSoundEffects[MAX_SAMPLES][255];// =
|
||||
// "SOUNDS\\WEAPONS\\LMG RELOAD.WAV", // LMG
|
||||
//
|
||||
// // FIREARM LOCKNLOAD
|
||||
// "SOUNDS\\WEAPONS\\REVOLVER LNL.WAV", // REVOLVER
|
||||
// "SOUNDS\\WEAPONS\\REVOLVER LNL.WAV", // REVOLVER
|
||||
// "SOUNDS\\WEAPONS\\PISTOL LNL.WAV", // PISTOL
|
||||
// "SOUNDS\\WEAPONS\\SMG LNL.WAV", // SMG
|
||||
// "SOUNDS\\WEAPONS\\RIFLE LNL.WAV", // RIFLE
|
||||
@@ -168,7 +168,7 @@ char szSoundEffects[MAX_SAMPLES][255];// =
|
||||
// "SOUNDS\\WEAPONS\\SMALL ROCKET LAUNCHER.WAV", // SMALL ROCKET LUANCHER
|
||||
// "SOUNDS\\WEAPONS\\MORTAR FIRE 01.WAV", // GRENADE LAUNCHER
|
||||
// "SOUNDS\\WEAPONS\\MORTAR FIRE 01.WAV", // UNDERSLUNG GRENADE LAUNCHER
|
||||
// "SOUNDS\\WEAPONS\\ROCKET LAUNCHER.WAV",
|
||||
// "SOUNDS\\WEAPONS\\ROCKET LAUNCHER.WAV",
|
||||
// "SOUNDS\\WEAPONS\\MORTAR FIRE 01.WAV",
|
||||
//
|
||||
// // FIREARMS
|
||||
@@ -263,7 +263,7 @@ char szSoundEffects[MAX_SAMPLES][255];// =
|
||||
// "SOUNDS\\ARMPIT.WAV",
|
||||
// "SOUNDS\\CRACKING BACK.WAV",
|
||||
//
|
||||
// "SOUNDS\\WEAPONS\\Auto Resolve Composite 02 (8-22).wav",// The FF sound in autoresolve interface
|
||||
// "SOUNDS\\WEAPONS\\Auto Resolve Composite 02 (8-22).wav",// The FF sound in autoresolve interface
|
||||
//
|
||||
// "SOUNDS\\Email Alert 01.wav",
|
||||
// "SOUNDS\\Entering Text 02.wav",
|
||||
@@ -315,10 +315,10 @@ char szSoundEffects[MAX_SAMPLES][255];// =
|
||||
// "SOUNDS\\remote activate.WAV",
|
||||
// "SOUNDS\\wirecutters.WAV",
|
||||
// "SOUNDS\\drink from canteen.WAV",
|
||||
// "SOUNDS\\bloodcat attack.wav",
|
||||
// "SOUNDS\\bloodcat loud roar.wav",
|
||||
// "SOUNDS\\robot greeting.wav",
|
||||
// "SOUNDS\\robot death.wav",
|
||||
// "SOUNDS\\bloodcat attack.wav",
|
||||
// "SOUNDS\\bloodcat loud roar.wav",
|
||||
// "SOUNDS\\robot greeting.wav",
|
||||
// "SOUNDS\\robot death.wav",
|
||||
// "SOUNDS\\gas grenade explode.WAV",
|
||||
// "SOUNDS\\air escaping.WAV",
|
||||
// "SOUNDS\\drawer open.WAV",
|
||||
@@ -328,53 +328,53 @@ char szSoundEffects[MAX_SAMPLES][255];// =
|
||||
// "SOUNDS\\wooden box open.WAV",
|
||||
// "SOUNDS\\wooden box close.WAV",
|
||||
// "SOUNDS\\robot stop moving.WAV",
|
||||
// "SOUNDS\\water movement 01.wav",
|
||||
// "SOUNDS\\water movement 02.wav",
|
||||
// "SOUNDS\\water movement 03.wav",
|
||||
// "SOUNDS\\water movement 04.wav",
|
||||
// "SOUNDS\\PRONE TO CROUCH.WAV",
|
||||
// "SOUNDS\\CROUCH TO PRONE.WAV",
|
||||
// "SOUNDS\\CROUCH TO STAND.WAV",
|
||||
// "SOUNDS\\STAND TO CROUCH.WAV",
|
||||
// "SOUNDS\\picking something up.WAV",
|
||||
// "SOUNDS\\cow falling.wav",
|
||||
// "SOUNDS\\bloodcat_growl_01.wav",
|
||||
// "SOUNDS\\bloodcat_growl_02.wav",
|
||||
// "SOUNDS\\bloodcat_growl_03.wav",
|
||||
// "SOUNDS\\bloodcat_growl_04.wav",
|
||||
// "SOUNDS\\spit ricochet.wav",
|
||||
// "SOUNDS\\water movement 01.wav",
|
||||
// "SOUNDS\\water movement 02.wav",
|
||||
// "SOUNDS\\water movement 03.wav",
|
||||
// "SOUNDS\\water movement 04.wav",
|
||||
// "SOUNDS\\PRONE TO CROUCH.WAV",
|
||||
// "SOUNDS\\CROUCH TO PRONE.WAV",
|
||||
// "SOUNDS\\CROUCH TO STAND.WAV",
|
||||
// "SOUNDS\\STAND TO CROUCH.WAV",
|
||||
// "SOUNDS\\picking something up.WAV",
|
||||
// "SOUNDS\\cow falling.wav",
|
||||
// "SOUNDS\\bloodcat_growl_01.wav",
|
||||
// "SOUNDS\\bloodcat_growl_02.wav",
|
||||
// "SOUNDS\\bloodcat_growl_03.wav",
|
||||
// "SOUNDS\\bloodcat_growl_04.wav",
|
||||
// "SOUNDS\\spit ricochet.wav",
|
||||
// "SOUNDS\\ADULT crippled.WAV",
|
||||
// "SOUNDS\\death disintegration.wav",
|
||||
// "SOUNDS\\Queen Ambience.wav",
|
||||
// "SOUNDS\\Alien Impact.wav",
|
||||
// "SOUNDS\\crow pecking flesh 01.wav",
|
||||
// "SOUNDS\\crow fly.wav",
|
||||
// "SOUNDS\\slap 02.wav",
|
||||
// "SOUNDS\\setting up mortar.wav",
|
||||
// "SOUNDS\\mortar whistle.wav",
|
||||
// "SOUNDS\\load mortar.wav",
|
||||
// "SOUNDS\\tank turret a.wav",
|
||||
// "SOUNDS\\tank turret b.wav",
|
||||
// "SOUNDS\\cow falling b.wav",
|
||||
// "SOUNDS\\stab into flesh.wav",
|
||||
// "SOUNDS\\explosion 10.wav",
|
||||
// "SOUNDS\\explosion 12.wav",
|
||||
// "SOUNDS\\death disintegration.wav",
|
||||
// "SOUNDS\\Queen Ambience.wav",
|
||||
// "SOUNDS\\Alien Impact.wav",
|
||||
// "SOUNDS\\crow pecking flesh 01.wav",
|
||||
// "SOUNDS\\crow fly.wav",
|
||||
// "SOUNDS\\slap 02.wav",
|
||||
// "SOUNDS\\setting up mortar.wav",
|
||||
// "SOUNDS\\mortar whistle.wav",
|
||||
// "SOUNDS\\load mortar.wav",
|
||||
// "SOUNDS\\tank turret a.wav",
|
||||
// "SOUNDS\\tank turret b.wav",
|
||||
// "SOUNDS\\cow falling b.wav",
|
||||
// "SOUNDS\\stab into flesh.wav",
|
||||
// "SOUNDS\\explosion 10.wav",
|
||||
// "SOUNDS\\explosion 12.wav",
|
||||
// "SOUNDS\\drink from canteen male.WAV",
|
||||
// "SOUNDS\\x ray activated.WAV",
|
||||
// "SOUNDS\\catch object.wav",
|
||||
// "SOUNDS\\fence open.wav",
|
||||
// "SOUNDS\\catch object.wav",
|
||||
// "SOUNDS\\fence open.wav",
|
||||
|
||||
////MADD MARKER
|
||||
////New Guns
|
||||
// "SOUNDS\\WEAPONS\\50CAL.WAV",
|
||||
// "SOUNDS\\WEAPONS\\VALSILENT.WAV"
|
||||
//// "SOUNDS\\BreakLight.wav",
|
||||
//// "SOUNDS\\BreakLight.wav",
|
||||
//};
|
||||
|
||||
char szAmbientEffects[NUM_AMBIENTS][255] =
|
||||
{
|
||||
"SOUNDS\\storm1.wav",
|
||||
"SOUNDS\\storm2.wav",
|
||||
"SOUNDS\\storm1.wav",
|
||||
"SOUNDS\\storm2.wav",
|
||||
"SOUNDS\\rain_loop_22k.wav",
|
||||
"SOUNDS\\bird1-22k.wav",
|
||||
"SOUNDS\\bird3-22k.wav",
|
||||
@@ -408,7 +408,7 @@ UINT8 AmbientVols[NUM_AMBIENTS]={
|
||||
|
||||
|
||||
SOUNDPARMS gDelayedSoundParms;
|
||||
UINT32 guiDelayedSoundNum;
|
||||
UINT32 guiDelayedSoundNum;
|
||||
void DelayedSoundTimerCallback( void );
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ BOOLEAN ShutdownJA2Sound( )
|
||||
//}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan )
|
||||
{
|
||||
@@ -448,10 +448,10 @@ UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoo
|
||||
memset(&spParms, 0xff, sizeof(SOUNDPARMS));
|
||||
|
||||
spParms.uiSpeed = usRate;
|
||||
|
||||
|
||||
if ( strstr( szSoundEffects[usNum], "WEAPONS" ) == NULL )
|
||||
{
|
||||
spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume );
|
||||
spParms.uiVolume = CalculateSoundEffectsVolume( ubVolume );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -471,7 +471,7 @@ UINT32 PlayJA2Sample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoo
|
||||
|
||||
UINT32 PlayJA2StreamingSample( UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan )
|
||||
{
|
||||
SOUNDPARMS spParms;
|
||||
SOUNDPARMS spParms;
|
||||
|
||||
memset(&spParms, 0xff, sizeof(SOUNDPARMS));
|
||||
|
||||
@@ -505,7 +505,7 @@ UINT32 PlayJA2SampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ubVolume, U
|
||||
{
|
||||
spParms.uiVolume = (UINT32)( ( ubVolume / (FLOAT) HIGHVOLUME ) * guiSoundEffectsVolume +.5 ) * (1 + gGameExternalOptions.guiWeaponSoundEffectsVolume / 100);
|
||||
}
|
||||
|
||||
|
||||
spParms.uiLoop = ubLoops;
|
||||
spParms.uiPan = uiPan;
|
||||
spParms.uiPriority=GROUP_PLAYER;
|
||||
@@ -520,7 +520,7 @@ UINT32 PlayJA2StreamingSampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ub
|
||||
|
||||
// does the same thing as PlayJA2Sound, but one only has to pass the filename, not the index of the sound array
|
||||
|
||||
SOUNDPARMS spParms;
|
||||
SOUNDPARMS spParms;
|
||||
|
||||
memset(&spParms, 0xff, sizeof(SOUNDPARMS));
|
||||
|
||||
@@ -529,7 +529,7 @@ UINT32 PlayJA2StreamingSampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ub
|
||||
spParms.uiLoop = ubLoops;
|
||||
spParms.uiPan = uiPan;
|
||||
spParms.uiPriority=GROUP_PLAYER;
|
||||
spParms.EOSCallback=EndsCallback;
|
||||
spParms.EOSCallback=EndsCallback;
|
||||
|
||||
return( SoundPlayStreamedFile(szFileName, &spParms) );
|
||||
}
|
||||
@@ -569,13 +569,13 @@ UINT32 PlaySoldierJA2Sample( UINT16 usID, UINT32 usNum, UINT32 usRate, UINT32 ub
|
||||
{
|
||||
|
||||
if( !( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) )
|
||||
{
|
||||
// CHECK IF GUY IS ON SCREEN BEFORE PLAYING!
|
||||
if ( ( MercPtrs[ usID ]->bVisible != -1 ) || !fCheck )
|
||||
{
|
||||
return( PlayJA2Sample( usNum, usRate, CalculateSoundEffectsVolume( ubVolume ), ubLoops, uiPan ) );
|
||||
}
|
||||
}
|
||||
{
|
||||
// CHECK IF GUY IS ON SCREEN BEFORE PLAYING!
|
||||
if ( ( MercPtrs[ usID ]->bVisible != -1 ) || !fCheck )
|
||||
{
|
||||
return( PlayJA2Sample( usNum, usRate, CalculateSoundEffectsVolume( ubVolume ), ubLoops, uiPan ) );
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@@ -587,7 +587,7 @@ UINT32 PlaySoldierJA2Sample( UINT16 usID, UINT32 usNum, UINT32 usRate, UINT32 ub
|
||||
|
||||
void SetSpeechVolume( UINT32 uiNewVolume )
|
||||
{
|
||||
guiSpeechVolume = __min( uiNewVolume, 127);
|
||||
guiSpeechVolume = __min( uiNewVolume, 127);
|
||||
}
|
||||
|
||||
|
||||
@@ -600,7 +600,7 @@ UINT32 GetSpeechVolume( )
|
||||
|
||||
void SetSoundEffectsVolume( UINT32 uiNewVolume )
|
||||
{
|
||||
guiSoundEffectsVolume = __min( uiNewVolume, 127);
|
||||
guiSoundEffectsVolume = __min( uiNewVolume, 127);
|
||||
}
|
||||
|
||||
|
||||
@@ -632,26 +632,26 @@ int x,dif,absDif;
|
||||
dif = ScreenMiddleX - x;
|
||||
|
||||
if ( (absDif=abs(dif)) > 32)
|
||||
{
|
||||
// OK, NOT the middle.
|
||||
{
|
||||
// OK, NOT the middle.
|
||||
|
||||
// Is it outside the screen?
|
||||
if (absDif > HalfWindowWidth)
|
||||
{
|
||||
// yes, outside...
|
||||
if (dif > 0)
|
||||
return(25);
|
||||
else
|
||||
return(102);
|
||||
}
|
||||
else // inside screen
|
||||
if (dif > 0)
|
||||
return(LEFTSIDE);
|
||||
else
|
||||
return(RIGHTSIDE);
|
||||
}
|
||||
// Is it outside the screen?
|
||||
if (absDif > HalfWindowWidth)
|
||||
{
|
||||
// yes, outside...
|
||||
if (dif > 0)
|
||||
return(25);
|
||||
else
|
||||
return(102);
|
||||
}
|
||||
else // inside screen
|
||||
if (dif > 0)
|
||||
return(LEFTSIDE);
|
||||
else
|
||||
return(RIGHTSIDE);
|
||||
}
|
||||
else // hardly any difference, so sound should be played from middle
|
||||
return(MIDDLE);
|
||||
return(MIDDLE);
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -664,10 +664,10 @@ INT32 SoundDir( INT16 sGridNo )
|
||||
INT16 sMiddleX;
|
||||
INT16 sDif, sAbsDif;
|
||||
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( MIDDLEPAN );
|
||||
}
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( MIDDLEPAN );
|
||||
}
|
||||
|
||||
// OK, get screen position of gridno.....
|
||||
ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY );
|
||||
@@ -681,21 +681,21 @@ INT32 SoundDir( INT16 sGridNo )
|
||||
sDif = sMiddleX - sScreenX;
|
||||
|
||||
if ( ( sAbsDif = (INT16) abs( sDif ) ) > 64 )
|
||||
{
|
||||
{
|
||||
// OK, NOT the middle.
|
||||
// Is it outside the screen?
|
||||
if ( sAbsDif > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) )
|
||||
{
|
||||
{
|
||||
// yes, outside...
|
||||
if ( sDif > 0 )
|
||||
{
|
||||
return( FARLEFT );
|
||||
//return( 1 );
|
||||
}
|
||||
else
|
||||
return( FARRIGHT );
|
||||
//return( 126 );
|
||||
}
|
||||
else
|
||||
return( FARRIGHT );
|
||||
//return( 126 );
|
||||
}
|
||||
else // inside screen
|
||||
{
|
||||
if ( sDif > 0)
|
||||
@@ -703,9 +703,9 @@ INT32 SoundDir( INT16 sGridNo )
|
||||
else
|
||||
return( RIGHTSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
else // hardly any difference, so sound should be played from middle
|
||||
return(MIDDLE);
|
||||
return(MIDDLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -717,10 +717,10 @@ INT32 SoundVolume( INT8 bInitialVolume, INT16 sGridNo )
|
||||
INT16 sDifX, sAbsDifX;
|
||||
INT16 sDifY, sAbsDifY;
|
||||
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( bInitialVolume );
|
||||
}
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( bInitialVolume );
|
||||
}
|
||||
|
||||
// OK, get screen position of gridno.....
|
||||
ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY );
|
||||
@@ -738,16 +738,16 @@ INT32 SoundVolume( INT8 bInitialVolume, INT16 sGridNo )
|
||||
sAbsDifX = (INT16) abs( sDifX );
|
||||
sAbsDifY = (INT16) abs( sDifY );
|
||||
|
||||
if ( sAbsDifX > 64 || sAbsDifY > 64 )
|
||||
{
|
||||
if ( sAbsDifX > 64 || sAbsDifY > 64 )
|
||||
{
|
||||
// OK, NOT the middle.
|
||||
// Is it outside the screen?
|
||||
if ( sAbsDifX > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) ||
|
||||
sAbsDifY > ( ( gsBottomRightWorldY - gsTopLeftWorldY ) / 2 ) )
|
||||
{
|
||||
if ( sAbsDifX > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) ||
|
||||
sAbsDifY > ( ( gsBottomRightWorldY - gsTopLeftWorldY ) / 2 ) )
|
||||
{
|
||||
return( __max( LOWVOLUME, ( bInitialVolume - SOUND_FAR_VOLUME_MOD ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return( bInitialVolume );
|
||||
}
|
||||
|
||||
@@ -791,13 +791,13 @@ void DelayedSoundTimerCallback( void )
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 uiFlags;
|
||||
INT16 sGridNo;
|
||||
INT32 iSoundSampleID;
|
||||
INT32 iSoundToPlay;
|
||||
UINT32 uiData;
|
||||
BOOLEAN fAllocated;
|
||||
BOOLEAN fInActive;
|
||||
UINT32 uiFlags;
|
||||
INT16 sGridNo;
|
||||
INT32 iSoundSampleID;
|
||||
INT32 iSoundToPlay;
|
||||
UINT32 uiData;
|
||||
BOOLEAN fAllocated;
|
||||
BOOLEAN fInActive;
|
||||
|
||||
} POSITIONSND;
|
||||
|
||||
@@ -805,7 +805,7 @@ typedef struct
|
||||
// GLOBAL FOR SMOKE LISTING
|
||||
POSITIONSND gPositionSndData[ NUM_POSITION_SOUND_EFFECT_SLOTS ];
|
||||
UINT32 guiNumPositionSnds = 0;
|
||||
BOOLEAN gfPositionSoundsActive = FALSE;
|
||||
BOOLEAN gfPositionSoundsActive = FALSE;
|
||||
|
||||
|
||||
INT32 GetFreePositionSnd( void );
|
||||
@@ -857,114 +857,114 @@ INT32 NewPositionSnd( INT16 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoun
|
||||
pPositionSnd = &gPositionSndData[ iPositionSndIndex ];
|
||||
|
||||
|
||||
// Default to inactive
|
||||
// Default to inactive
|
||||
|
||||
if ( gfPositionSoundsActive )
|
||||
{
|
||||
pPositionSnd->fInActive = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pPositionSnd->fInActive = TRUE;
|
||||
}
|
||||
|
||||
pPositionSnd->sGridNo = sGridNo;
|
||||
pPositionSnd->uiData = uiData;
|
||||
pPositionSnd->uiFlags = uiFlags;
|
||||
pPositionSnd->fAllocated = TRUE;
|
||||
pPositionSnd->iSoundToPlay = iSoundToPlay;
|
||||
if ( gfPositionSoundsActive )
|
||||
{
|
||||
pPositionSnd->fInActive = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pPositionSnd->fInActive = TRUE;
|
||||
}
|
||||
|
||||
pPositionSnd->iSoundSampleID = NO_SAMPLE;
|
||||
pPositionSnd->sGridNo = sGridNo;
|
||||
pPositionSnd->uiData = uiData;
|
||||
pPositionSnd->uiFlags = uiFlags;
|
||||
pPositionSnd->fAllocated = TRUE;
|
||||
pPositionSnd->iSoundToPlay = iSoundToPlay;
|
||||
|
||||
return( iPositionSndIndex );
|
||||
pPositionSnd->iSoundSampleID = NO_SAMPLE;
|
||||
|
||||
return( iPositionSndIndex );
|
||||
}
|
||||
|
||||
void DeletePositionSnd( INT32 iPositionSndIndex )
|
||||
{
|
||||
POSITIONSND *pPositionSnd;
|
||||
|
||||
pPositionSnd = &gPositionSndData[ iPositionSndIndex ];
|
||||
pPositionSnd = &gPositionSndData[ iPositionSndIndex ];
|
||||
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
// Turn inactive first...
|
||||
pPositionSnd->fInActive = TRUE;
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
// Turn inactive first...
|
||||
pPositionSnd->fInActive = TRUE;
|
||||
|
||||
// End sound...
|
||||
if ( pPositionSnd->iSoundSampleID != NO_SAMPLE )
|
||||
{
|
||||
SoundStop( pPositionSnd->iSoundSampleID );
|
||||
}
|
||||
// End sound...
|
||||
if ( pPositionSnd->iSoundSampleID != NO_SAMPLE )
|
||||
{
|
||||
SoundStop( pPositionSnd->iSoundSampleID );
|
||||
}
|
||||
|
||||
pPositionSnd->fAllocated = FALSE;
|
||||
pPositionSnd->fAllocated = FALSE;
|
||||
|
||||
RecountPositionSnds( );
|
||||
}
|
||||
RecountPositionSnds( );
|
||||
}
|
||||
}
|
||||
|
||||
void SetPositionSndGridNo( INT32 iPositionSndIndex, INT16 sGridNo )
|
||||
{
|
||||
POSITIONSND *pPositionSnd;
|
||||
|
||||
pPositionSnd = &gPositionSndData[ iPositionSndIndex ];
|
||||
pPositionSnd = &gPositionSndData[ iPositionSndIndex ];
|
||||
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
pPositionSnd->sGridNo = sGridNo;
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
pPositionSnd->sGridNo = sGridNo;
|
||||
|
||||
SetPositionSndsVolumeAndPanning( );
|
||||
}
|
||||
SetPositionSndsVolumeAndPanning( );
|
||||
}
|
||||
}
|
||||
|
||||
void SetPositionSndsActive( )
|
||||
{
|
||||
UINT32 cnt;
|
||||
UINT32 cnt;
|
||||
POSITIONSND *pPositionSnd;
|
||||
|
||||
gfPositionSoundsActive = TRUE;
|
||||
gfPositionSoundsActive = TRUE;
|
||||
|
||||
for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ )
|
||||
{
|
||||
pPositionSnd = &gPositionSndData[ cnt ];
|
||||
for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ )
|
||||
{
|
||||
pPositionSnd = &gPositionSndData[ cnt ];
|
||||
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
if ( pPositionSnd->fInActive )
|
||||
{
|
||||
pPositionSnd->fInActive = FALSE;
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
if ( pPositionSnd->fInActive )
|
||||
{
|
||||
pPositionSnd->fInActive = FALSE;
|
||||
|
||||
// Begin sound effect
|
||||
// Volume 0
|
||||
pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Begin sound effect
|
||||
// Volume 0
|
||||
pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SetPositionSndsInActive( )
|
||||
{
|
||||
UINT32 cnt;
|
||||
UINT32 cnt;
|
||||
POSITIONSND *pPositionSnd;
|
||||
|
||||
gfPositionSoundsActive = FALSE;
|
||||
gfPositionSoundsActive = FALSE;
|
||||
|
||||
for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ )
|
||||
{
|
||||
pPositionSnd = &gPositionSndData[ cnt ];
|
||||
for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ )
|
||||
{
|
||||
pPositionSnd = &gPositionSndData[ cnt ];
|
||||
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
pPositionSnd->fInActive = TRUE;
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
pPositionSnd->fInActive = TRUE;
|
||||
|
||||
// End sound...
|
||||
if ( pPositionSnd->iSoundSampleID != NO_SAMPLE )
|
||||
{
|
||||
SoundStop( pPositionSnd->iSoundSampleID );
|
||||
pPositionSnd->iSoundSampleID = NO_SAMPLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
// End sound...
|
||||
if ( pPositionSnd->iSoundSampleID != NO_SAMPLE )
|
||||
{
|
||||
SoundStop( pPositionSnd->iSoundSampleID );
|
||||
pPositionSnd->iSoundSampleID = NO_SAMPLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// == Lesh slightly changed this function ============
|
||||
@@ -975,10 +975,10 @@ UINT8 PositionSoundDir( INT16 sGridNo )
|
||||
INT16 sMiddleX;
|
||||
INT16 sDif, sAbsDif;
|
||||
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( MIDDLEPAN );
|
||||
}
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( MIDDLEPAN );
|
||||
}
|
||||
|
||||
// OK, get screen position of gridno.....
|
||||
ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY );
|
||||
@@ -992,23 +992,23 @@ UINT8 PositionSoundDir( INT16 sGridNo )
|
||||
sDif = sMiddleX - sScreenX;
|
||||
|
||||
if ( ( sAbsDif = (INT16) abs( sDif ) ) > 64 )
|
||||
{
|
||||
{
|
||||
// OK, NOT the middle.
|
||||
|
||||
|
||||
// Is it outside the screen?
|
||||
if ( sAbsDif > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) )
|
||||
{
|
||||
{
|
||||
// yes, outside...
|
||||
if ( sDif > 0 )
|
||||
{
|
||||
return( FARLEFT );
|
||||
//return( 1 );
|
||||
}
|
||||
else
|
||||
return( FARRIGHT );
|
||||
//return( 126 );
|
||||
else
|
||||
return( FARRIGHT );
|
||||
//return( 126 );
|
||||
|
||||
}
|
||||
}
|
||||
else // inside screen
|
||||
{
|
||||
if ( sDif > 0)
|
||||
@@ -1016,9 +1016,9 @@ UINT8 PositionSoundDir( INT16 sGridNo )
|
||||
else
|
||||
return( RIGHTSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
else // hardly any difference, so sound should be played from middle
|
||||
return(MIDDLE);
|
||||
return(MIDDLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1029,13 +1029,13 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT16 sGridNo )
|
||||
INT16 sMiddleX, sMiddleY;
|
||||
INT16 sDifX, sAbsDifX;
|
||||
INT16 sDifY, sAbsDifY;
|
||||
INT16 sMaxDistX, sMaxDistY;
|
||||
double sMaxSoundDist, sSoundDist;
|
||||
INT16 sMaxDistX, sMaxDistY;
|
||||
double sMaxSoundDist, sSoundDist;
|
||||
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( bInitialVolume );
|
||||
}
|
||||
if ( sGridNo == NOWHERE )
|
||||
{
|
||||
return( bInitialVolume );
|
||||
}
|
||||
|
||||
// OK, get screen position of gridno.....
|
||||
ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY );
|
||||
@@ -1053,60 +1053,60 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT16 sGridNo )
|
||||
sAbsDifX = (INT16) abs( sDifX );
|
||||
sAbsDifY = (INT16) abs( sDifY );
|
||||
|
||||
sMaxDistX = (INT16)( ( gsBottomRightWorldX - gsTopLeftWorldX ) * 1.5 );
|
||||
sMaxDistY = (INT16)( ( gsBottomRightWorldY - gsTopLeftWorldY ) * 1.5 );
|
||||
sMaxDistX = (INT16)( ( gsBottomRightWorldX - gsTopLeftWorldX ) * 1.5 );
|
||||
sMaxDistY = (INT16)( ( gsBottomRightWorldY - gsTopLeftWorldY ) * 1.5 );
|
||||
|
||||
sMaxSoundDist = sqrt( (double) ( sMaxDistX * sMaxDistX ) + ( sMaxDistY * sMaxDistY ) );
|
||||
sSoundDist = sqrt( (double)( sAbsDifX * sAbsDifX ) + ( sAbsDifY * sAbsDifY ) );
|
||||
sMaxSoundDist = sqrt( (double) ( sMaxDistX * sMaxDistX ) + ( sMaxDistY * sMaxDistY ) );
|
||||
sSoundDist = sqrt( (double)( sAbsDifX * sAbsDifX ) + ( sAbsDifY * sAbsDifY ) );
|
||||
|
||||
if ( sSoundDist == 0 )
|
||||
{
|
||||
return( bInitialVolume );
|
||||
}
|
||||
if ( sSoundDist == 0 )
|
||||
{
|
||||
return( bInitialVolume );
|
||||
}
|
||||
|
||||
if ( sSoundDist > sMaxSoundDist )
|
||||
{
|
||||
sSoundDist = sMaxSoundDist;
|
||||
}
|
||||
if ( sSoundDist > sMaxSoundDist )
|
||||
{
|
||||
sSoundDist = sMaxSoundDist;
|
||||
}
|
||||
|
||||
// Scale
|
||||
return( (INT8)( bInitialVolume * ( ( sMaxSoundDist - sSoundDist ) / sMaxSoundDist ) ) );
|
||||
// Scale
|
||||
return( (INT8)( bInitialVolume * ( ( sMaxSoundDist - sSoundDist ) / sMaxSoundDist ) ) );
|
||||
}
|
||||
|
||||
|
||||
void SetPositionSndsVolumeAndPanning( )
|
||||
{
|
||||
UINT32 cnt;
|
||||
UINT32 cnt;
|
||||
POSITIONSND *pPositionSnd;
|
||||
INT8 bVolume;
|
||||
UINT8 ubPan;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
INT8 bVolume;
|
||||
UINT8 ubPan;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
|
||||
for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ )
|
||||
{
|
||||
pPositionSnd = &gPositionSndData[ cnt ];
|
||||
for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ )
|
||||
{
|
||||
pPositionSnd = &gPositionSndData[ cnt ];
|
||||
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
if ( !pPositionSnd->fInActive )
|
||||
{
|
||||
if ( pPositionSnd->iSoundSampleID != NO_SAMPLE )
|
||||
{
|
||||
bVolume = PositionSoundVolume( 15, pPositionSnd->sGridNo );
|
||||
if ( pPositionSnd->fAllocated )
|
||||
{
|
||||
if ( !pPositionSnd->fInActive )
|
||||
{
|
||||
if ( pPositionSnd->iSoundSampleID != NO_SAMPLE )
|
||||
{
|
||||
bVolume = PositionSoundVolume( 15, pPositionSnd->sGridNo );
|
||||
|
||||
if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER )
|
||||
{
|
||||
pSoldier = (SOLDIERTYPE*)pPositionSnd->uiData;
|
||||
if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER )
|
||||
{
|
||||
pSoldier = (SOLDIERTYPE*)pPositionSnd->uiData;
|
||||
|
||||
if ( pSoldier->bVisible == -1 )
|
||||
{
|
||||
// Limit volume,,,
|
||||
if ( bVolume > 10 )
|
||||
{
|
||||
bVolume = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pSoldier->bVisible == -1 )
|
||||
{
|
||||
// Limit volume,,,
|
||||
if ( bVolume > 10 )
|
||||
{
|
||||
bVolume = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the sound is from a stationay object
|
||||
if( pPositionSnd->uiFlags & POSITION_SOUND_STATIONATY_OBJECT )
|
||||
@@ -1118,14 +1118,15 @@ void SetPositionSndsVolumeAndPanning( )
|
||||
}
|
||||
}
|
||||
|
||||
SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume );
|
||||
SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume );
|
||||
|
||||
ubPan = PositionSoundDir( pPositionSnd->sGridNo );
|
||||
|
||||
SoundSetPan( pPositionSnd->iSoundSampleID, ubPan );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user