MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / Pause

Method Pause

CrySoundSystem/SoundSystem.cpp:1514–1559  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1512
1513//////////////////////////////////////////////////////////////////////////
1514void CSoundSystem::Pause(bool bPause,bool bResetVolume)
1515{
1516 m_bPause=bPause;
1517 SoundListItor It=m_vecSounds.begin();
1518 while (It!=m_vecSounds.end())
1519 {
1520 CSound *pSound=*It;
1521 if (pSound->m_nChannel>=0)
1522 {
1523 if (bPause)
1524 CS_SetPaused(pSound->m_nChannel,1);
1525 else
1526 {
1527 pSound->m_fChannelPlayTime=GetISystem()->GetITimer()->GetCurrTime();
1528 CS_SetPaused(pSound->m_nChannel,0);
1529 }
1530 }
1531 ++It;
1532 } //It
1533
1534 if (bResetVolume)
1535 {
1536 // this is needed for instance when going back to menu
1537 // after setting the sound volume to 0. The sound volume
1538 // calculation takes the general volume into account,
1539 // so if it was set to 0, when going to menu the sliders
1540 // and buttons won't produce any sound, because the sound system
1541 // is not updated anymore so it doesn't have a chance to
1542 // update the general volume. Hence we reset the volume to 1,
1543 // and the individual volume of sound and music sliders is set
1544 // by the menu scripts calling setvolume
1545 //m_fSFXResetVolume=m_pCVarSFXVolume->GetFVal();
1546 //m_pCVarSFXVolume->Set(1.0f);
1547 m_bResetVolume=true;
1548 m_fSFXVolume=1.0f; //m_pCVarSFXVolume->GetFVal();
1549 }
1550
1551 if (!bPause && m_bResetVolume)
1552 {
1553 // restore normal volume back
1554 //m_pCVarSFXVolume->Set(m_fSFXResetVolume);
1555 m_bResetVolume=false;
1556 m_fSFXVolume=m_pCVarSFXVolume->GetFVal();
1557 //SetGroupScale(SOUNDSCALE_MISSIONHINT,m_fSFXVolume*0.65f);
1558 }
1559}
1560
1561//////////////////////////////////////////////////////////////////////////
1562void CSoundSystem::Mute(bool bMute)

Callers

nothing calls this directly

Calls 6

GetITimerMethod · 0.80
GetFValMethod · 0.80
GetISystemFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
GetCurrTimeMethod · 0.45

Tested by

no test coverage detected