示例#1
0
void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT16 sGridNo, INT16 sRadius )
{
	INT16 x, y, sNewGridNo;
	UINT8	ubID;
	SOLDIERTYPE *pSoldier;


	PlayJA2Sample( CAVE_COLLAPSE, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
	for( y = -sRadius; y <= sRadius; y++ ) for( x = -sRadius; x <= sRadius; x++ )
	{
		sNewGridNo = sGridNo + y * WORLD_COLS + x;
		//Validate gridno location, and check if there are any mercs here.  If there are
		//any mercs, we want them to fall below.  The exitgrid already exists at this location
		if( GridNoOnVisibleWorldTile( sNewGridNo ) )
		{

			// Check if buddy exists here.....
			ubID = WhoIsThere2( sNewGridNo, 0 );

			if ( ubID != NOBODY )
			{
				// OK, make guy fall...
				// Set data to look for exit grid....
				pSoldier = MercPtrs[ ubID ];

				pSoldier->uiPendingActionData4 = sNewGridNo;

				EVENT_InitNewSoldierAnim( pSoldier, FALL_INTO_PIT, 0 , FALSE );
			}			
		}
	}
}
示例#2
0
文件: xsound.cpp 项目: KranX/Vangers
void GlobalVolume(int volume)
{
	int i;
	std::cout<<"GlobalVolume:"<<volume<<std::endl;
	for(i = 0; i < MAX_CHANNELS; i ++)
		SoundVolume(i, volume);
}
//--------------------------- Volume
 PyObject* LMF_SoundVolume(PyObject *self, PyObject *args){
	int iSoundID;
	float fVol;
	if (!PyArg_ParseTuple(args, "if", &iSoundID, &fVol)) {
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	SoundVolume(iSoundID,fVol);
	Py_RETURN_NONE;
}
示例#4
0
////////////////////////////////////////////////////////////
/// Update sounds volume
////////////////////////////////////////////////////////////
void SoundBufferVolume(float Volume)
{
	Int32 i = 0;

	for (i = 0; i < SOUND_BUFFER_SIZE; i++)
	{
		if (SoundData[i].Buffer != 0)
		{
			// Set volume sound
			SoundVolume(&SoundData[i], Volume);
		}
	}

	SoundGeneralVolume = Volume;
}
示例#5
0
LTBOOL CGameSettings::Init (ILTClient* pClientDE, CGameClientShell* pClientShell)
{
    if (!pClientDE || !pClientShell) return LTFALSE;

	m_pClientDE = pClientDE;
	m_pClientShell = pClientShell;

	g_vtMouseScaleBase.Init(g_pLTClient, "MouseScaleBase", NULL, 0.00125f);
	g_vtMouseScaleInc.Init(g_pLTClient, "MouseScaleIncrement", NULL, 0.001125f);

	// check if gore is allowed

    uint32 dwAdvancedOptions = g_pInterfaceMgr->GetAdvancedOptions();

	if (dwAdvancedOptions & AO_MUSIC)
	{
		m_pClientDE->RunConsoleString("musicenable 1");
	}
	else
	{
		m_pClientDE->RunConsoleString("musicenable 0");
	}
	if (dwAdvancedOptions & AO_SOUND)
	{
		m_pClientDE->RunConsoleString("soundenable 1");
	}
	else
	{
		m_pClientDE->RunConsoleString("soundenable 0");
	}

	// implement settings that need implementing

    ImplementMouseSensitivity();

	// hack to keep sound volume reasonable
	if (SoundVolume() > 100.0f)
		SetFloatVar("SoundVolume",100.0f);

  	ImplementSoundVolume();
	ImplementSoundQuality();

    return LTTRUE;
}
示例#6
0
void CGameSettings::ImplementSoundVolume()
{
	if (!m_pClientDE) return;

	float nSoundVolume = SoundVolume();

	((ILTClientSoundMgr*)m_pClientDE->SoundMgr())->SetVolume((short)nSoundVolume);

	// set up the sound volume classes for the game
	float fMultiplier;
	fMultiplier = WeaponsMultiplier();
	((ILTClientSoundMgr*)m_pClientDE->SoundMgr())->SetSoundClassMultiplier( WEAPONS_SOUND_CLASS, fMultiplier );
	fMultiplier = SpeechMultiplier();
	((ILTClientSoundMgr*)m_pClientDE->SoundMgr())->SetSoundClassMultiplier( SPEECH_SOUND_CLASS, fMultiplier, false );
	fMultiplier = DefaultMultiplier();
	((ILTClientSoundMgr*)m_pClientDE->SoundMgr())->SetSoundClassMultiplier( DEFAULT_SOUND_CLASS, fMultiplier );

	// now have the sound manager update any playing sounds
	((ILTClientSoundMgr*)m_pClientDE->SoundMgr())->UpdateVolumeSettings();
}
示例#7
0
////////////////////////////////////////////////////////////
/// Play sound from file into buffer
////////////////////////////////////////////////////////////
void SoundBufferPlay(char * File, bool Looping, float x, float y, float z)
{
	struct Sound SoundStruct = { 0 };

	SoundBufferLoad(&SoundStruct, File);

	if (SoundStruct.Buffer != 0)
	{
		if (SoundStatus(&SoundStruct) == Stopped)
		{
			// Set volume
			SoundVolume(&SoundStruct, SoundGeneralVolume);

			// Set position
			SoundPosition(&SoundStruct, x, y, z);

			// Set looping
			SoundLoop(&SoundStruct, Looping);

			// Play sound
			SoundPlay(&SoundStruct);
		}
	}
}
示例#8
0
文件: sound.cpp 项目: KranX/Vangers
void SoundQuant(void)
{
    if(!EffectInUse) return;

    if(MusicON) {
        int _world_ = CurrentWorld;

        int Distance = DISTANCE_TO_TOWN;

        if (_world_ > 3) {
            _world_ = 4;
            Distance = DISTANCE_TO_SICRET;
        }

//		int len = GetEscaveDist();

        if (SoundVolumeCD == -1)
//			SoundVolumeCD = xsGetVolumeCD();
            SoundVolumeCD = xsGetVolumeMusic();

        /*		if ( len == -1 )
        			xsSetVolumeCD(0);
        		else*/ {
            time_t l_time;
            time(&l_time);

            if (l_time - lastTimeCD > TimeCD) {
//				int status = xsGetStatusCD();
                int status = xsGetStatusMusic();
                if (status & XCD_PAUSED)
                    StartWTRACK();
            }

//			if(len > Distance) len = 0; else len = Distance - abs(len);
        }

//		xsSetVolumeCD(len*SoundVolumeCD/Distance);
    }

    int DiffSound = SoundFlag ^ lastSoundFlag;

    if (DiffSound) {
        if (DiffSound & SoundCopterig)
            if (SoundFlag & SoundCopterig) {
                SOUND_COPTERIG_START()
            } else {
                SOUND_COPTERIG_STOP()
            }

        if (DiffSound & SoundCrotrig)
            if (SoundFlag & SoundCrotrig) {
                SOUND_CROTRIG_START()
            } else {
                SOUND_CROTRIG_STOP()
            }

        if (DiffSound & SoundCutterig)
            if (SoundFlag & SoundCutterig) {
                SOUND_CUTTERIG_START()
            } else {
                SOUND_CUTTERIG_STOP()
            }

        if (DiffSound & SoundUnderWater)
            if (SoundFlag & SoundUnderWater) {
                SOUND_UNDERWATER_START()
            } else {
                SOUND_UNDERWATER_STOP()
            }

        if (DiffSound & SoundMotor)
            if (SoundFlag & SoundMotor) {
                SOUND_START_MOTOR()
            } else {
                SOUND_STOP_MOTOR()
            }
    }

    lastSoundFlag = SoundFlag;

    /* Громкость расчитывается с учётом размера мира? или растояния от карты.
    int d = ViewZ - preViewZ;
    if(!d) {
    	return;
    }
    std::cout<<"AAAAAAAAAAAAA"<<std::cout;
    if(ViewZ >= 512) {
    	d = soundVolume - DB_SIZE/32 - (ViewZ - 512)*DB_SIZE/4/(1024 - 512);
    } else {
    	d = soundVolume - DB_SIZE/32 + (512 - ViewZ)*DB_SIZE/4/(512 - 384);
    }
    preViewZ = ViewZ;

    soundVolumecurrent = d;
    if(soundVolumecurrent < DB_MIN) {
    	soundVolumecurrent = DB_MIN;
    } else {
    	if(soundVolumecurrent > DB_MAX) {
    		soundVolumecurrent = DB_MAX;
    	}
    }*/

    for(int i = 0; i < 16; i++) {
        if(i != LOCAL_CHANNEL) {
            SoundVolume(i,soundVolumecurrent);
        }
    }
}
示例#9
0
void UpdateAniTiles( )
{
	ANITILE *pAniNode			= NULL;
	ANITILE *pNode				= NULL;
	UINT32	uiClock				= GetJA2Clock( );
	UINT16	usMaxFrames, usMinFrames;
	UINT8		ubTempDir;

	// LOOP THROUGH EACH NODE
	pAniNode = pAniTileHead;

	while( pAniNode != NULL )
	{
		pNode = pAniNode;
		pAniNode = pAniNode->pNext;

		if ( (uiClock - pNode->uiTimeLastUpdate ) > (UINT32)pNode->sDelay && !( pNode->uiFlags & ANITILE_PAUSED ) )
		{
			pNode->uiTimeLastUpdate = GetJA2Clock( );
					
			if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSLOWMOVING ) )
			{
				pNode->pLevelNode->uiFlags |= (LEVELNODE_DYNAMIC );
				pNode->pLevelNode->uiFlags &= (~LEVELNODE_LASTDYNAMIC);
			}
			else if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSMOKEEFFECT ) )
			{
			//	pNode->pLevelNode->uiFlags |= LEVELNODE_DYNAMICZ;
				ResetSpecificLayerOptimizing( TILES_DYNAMIC_STRUCTURES );
				pNode->pLevelNode->uiFlags &= (~LEVELNODE_LASTDYNAMIC);
				pNode->pLevelNode->uiFlags |= (LEVELNODE_DYNAMIC );
			}

			if ( pNode->uiFlags & ANITILE_FORWARD )
			{
				usMaxFrames = pNode->usNumFrames;

				if ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME )
				{
					ubTempDir = gOneCDirection[ pNode->uiUserData3 ];
					usMaxFrames = (UINT16)usMaxFrames + ( pNode->usNumFrames * ubTempDir );
				}

				if ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME )
				{
					ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ];
					usMaxFrames = (UINT16)usMaxFrames + ( pNode->usNumFrames * ubTempDir );
				}

				if ( ( pNode->sCurrentFrame + 1 ) < usMaxFrames )
				{
					pNode->sCurrentFrame++;
					pNode->pLevelNode->sCurrentFrame = pNode->sCurrentFrame;

					if ( pNode->uiFlags & ANITILE_EXPLOSION )
					{
						// Talk to the explosion data...
						UpdateExplosionFrame( pNode->uiUserData3, pNode->sCurrentFrame );
					}

					// CHECK IF WE SHOULD BE DISPLAYING TRANSLUCENTLY!
					if ( pNode->sCurrentFrame == pNode->ubKeyFrame1 )
					{
						switch( pNode->uiKeyFrame1Code )
						{
							case ANI_KEYFRAME_BEGIN_TRANSLUCENCY:

								pNode->pLevelNode->uiFlags |= LEVELNODE_REVEAL;
								break;

							case ANI_KEYFRAME_CHAIN_WATER_EXPLOSION:
								
								IgniteExplosion( pNode->ubUserData2, pNode->pLevelNode->sRelativeX, pNode->pLevelNode->sRelativeY, 0, pNode->sGridNo, (UINT16)( pNode->uiUserData ), 0 );
								break;

              case ANI_KEYFRAME_DO_SOUND:

                PlayJA2Sample( pNode->uiUserData, RATE_11025, SoundVolume( MIDVOLUME, (INT16)pNode->uiUserData3 ), 1, SoundDir( (INT16)pNode->uiUserData3 ) );			
                break;
						}

					} 

					// CHECK IF WE SHOULD BE DISPLAYING TRANSLUCENTLY!
					if ( pNode->sCurrentFrame == pNode->ubKeyFrame2 )
					{
            UINT8     ubExpType;

           	switch( pNode->uiKeyFrame2Code )
						{
							case ANI_KEYFRAME_BEGIN_DAMAGE:

                ubExpType = Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubType;

                if ( ubExpType == EXPLOSV_TEARGAS || ubExpType == EXPLOSV_MUSTGAS || 
                     ubExpType == EXPLOSV_SMOKE )
                {
                  // Do sound....
                  // PlayJA2Sample( AIR_ESCAPING_1, RATE_11025, SoundVolume( HIGHVOLUME, pNode->sGridNo ), 1, SoundDir( pNode->sGridNo ) );			
		              NewSmokeEffect( pNode->sGridNo, (UINT16)pNode->uiUserData, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, (UINT8)pNode->ubUserData2 );
                }
                else
                {
    							SpreadEffect( pNode->sGridNo, Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubRadius, (UINT16)pNode->uiUserData, (UINT8)pNode->ubUserData2, FALSE, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, -1 );
                }
								// Forfait any other animations this frame....
								return;
						}

					}

				}
				else
				{
					// We are done!
					if ( pNode->uiFlags & ANITILE_LOOPING )
					{
						pNode->sCurrentFrame = pNode->sStartFrame;

						if ( ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME ) )
						{
							// Our start frame is actually a direction indicator
							ubTempDir = gOneCDirection[ pNode->uiUserData3 ];
							pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir );
						}

						if ( ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME ) )
						{
							// Our start frame is actually a direction indicator
							ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ];
							pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir );
						}

					}
					else if ( pNode->uiFlags & ANITILE_REVERSE_LOOPING )
					{
						// Turn off backwards flag
						pNode->uiFlags &= (~ANITILE_FORWARD );

						// Turn onn forwards flag
						pNode->uiFlags |= ANITILE_BACKWARD;
					}
					else
					{		
						// Delete from world!
						DeleteAniTile( pNode );

						// Turn back on redunency checks!
						gTacticalStatus.uiFlags &= (~NOHIDE_REDUNDENCY);

						return;
					}
				}
			}
			
			if ( pNode->uiFlags & ANITILE_BACKWARD )
			{
				if ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER )
				{	
					// ATE: Check if bounding box is on the screen...
					if ( pNode->bFrameCountAfterStart == 0 )
					{
						pNode->bFrameCountAfterStart = 1;
						pNode->pLevelNode->uiFlags |= (LEVELNODE_DYNAMIC );

						// Dangerous here, since we may not even be on the screen...
						SetRenderFlags( RENDER_FLAG_FULL );

						continue;
					}
				}

				usMinFrames = 0;

				if ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME )
				{
					ubTempDir = gOneCDirection[ pNode->uiUserData3 ];
					usMinFrames = ( pNode->usNumFrames * ubTempDir );
				}

				if ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME )
				{
					ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ];
					usMinFrames = ( pNode->usNumFrames * ubTempDir );
				}

				if ( ( pNode->sCurrentFrame - 1 ) >= usMinFrames )
				{
					pNode->sCurrentFrame--;
					pNode->pLevelNode->sCurrentFrame = pNode->sCurrentFrame;

					if ( pNode->uiFlags & ANITILE_EXPLOSION )
					{
						// Talk to the explosion data...
						UpdateExplosionFrame( pNode->uiUserData3, pNode->sCurrentFrame );
					}

				}
				else
				{
					// We are done!
					if ( pNode->uiFlags & ANITILE_PAUSE_AFTER_LOOP )
					{
						// Turn off backwards flag
						pNode->uiFlags &= (~ANITILE_BACKWARD );

						// Pause
						pNode->uiFlags |= ANITILE_PAUSED;

					}
					else if ( pNode->uiFlags & ANITILE_LOOPING )
					{
						pNode->sCurrentFrame = pNode->sStartFrame;

						if ( ( pNode->uiFlags & ANITILE_USE_DIRECTION_FOR_START_FRAME ) )
						{
							// Our start frame is actually a direction indicator
							ubTempDir = gOneCDirection[ pNode->uiUserData3 ];
							pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir );
						}
						if ( ( pNode->uiFlags & ANITILE_USE_4DIRECTION_FOR_START_FRAME ) )
						{
							// Our start frame is actually a direction indicator
							ubTempDir = gb4DirectionsFrom8[ pNode->uiUserData3 ];
							pNode->sCurrentFrame = (UINT16)( pNode->usNumFrames * ubTempDir );
						}

					}
					else if ( pNode->uiFlags & ANITILE_REVERSE_LOOPING )
					{
						// Turn off backwards flag
						pNode->uiFlags &= (~ANITILE_BACKWARD );

						// Turn onn forwards flag
						pNode->uiFlags |= ANITILE_FORWARD;
					}
					else
					{
						// Delete from world!
						DeleteAniTile( pNode );

						return;
					}

					if ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER )
					{	
						// ATE: Check if bounding box is on the screen...
						pNode->bFrameCountAfterStart = 0;
						//pNode->pLevelNode->uiFlags |= LEVELNODE_UPDATESAVEBUFFERONCE;

						// Dangerous here, since we may not even be on the screen...
						SetRenderFlags( RENDER_FLAG_FULL );

					}

				}

			}
			
		}
		else
		{
			if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSLOWMOVING ) )
			{
				// ONLY TURN OFF IF PAUSED...
				if ( ( pNode->uiFlags & ANITILE_ERASEITEMFROMSAVEBUFFFER ) )
				{	
					if ( pNode->uiFlags & ANITILE_PAUSED )
					{
						if ( pNode->pLevelNode->uiFlags & LEVELNODE_DYNAMIC )
						{
							pNode->pLevelNode->uiFlags &= (~LEVELNODE_DYNAMIC );
							pNode->pLevelNode->uiFlags |= (LEVELNODE_LASTDYNAMIC);
							SetRenderFlags( RENDER_FLAG_FULL );
						}
					}
				}
				else
				{
					pNode->pLevelNode->uiFlags &= (~LEVELNODE_DYNAMIC );
					pNode->pLevelNode->uiFlags |= (LEVELNODE_LASTDYNAMIC);
				}
			}
			else if ( pNode->uiFlags & ( ANITILE_OPTIMIZEFORSMOKEEFFECT ) )
			{
				pNode->pLevelNode->uiFlags |= (LEVELNODE_LASTDYNAMIC);
				pNode->pLevelNode->uiFlags &= (~LEVELNODE_DYNAMIC );
			}

		}

	}

}