• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

3D Sound toggle

Joined
Jan 9, 2009
Messages
614
Reaction score
152
Pretty easy to enable, but I havne't seen it in many servers.

Step 1. Open ZSoundEngine.h, search for "m_b3DSoundUpdate;", underneath that add

void Set3DSound( bool b3DSound ) { m_b3DSound = b3DSound; }

Step 2. Open ZSoundEngine.cpp, search for void ZSoundEngine::playSEFire(MMatchItemDesc *pDesc, float x, float y, float z, bool bPlayer)

Replace that entire function with this:

void ZSoundEngine::playSEFire(MMatchItemDesc *pDesc, float x, float y, float z, bool bPlayer)
{
if( !m_bSoundEnable || !pDesc ) return;

if( pDesc->m_nType.Ref() == MMIT_RANGE || pDesc->m_nType.Ref() == MMIT_CUSTOM )
{
char* szSndName = pDesc->m_szFireSndName;
if(bPlayer)
{
char szBuffer[64];

//3DSound
if(ZGetConfiguration()->GetAudio()->b3DSound)
{
sprintf( szBuffer, "%s_optional_2d", szSndName );
}
else
{
sprintf( szBuffer, "%s_2d", szSndName );
}
#ifdef _SOUND_LOG
mlog("%s stereo 2d sound is played..\n",szBuffer);
#endif
char* szDefault;
if (pDesc->m_nType.Ref() == MMIT_RANGE)
//3DSound
szDefault = szSndName;
else
szDefault = szSndName;

PlaySoundElseDefault(szBuffer,szDefault,rvector(x,y,z),bPlayer);
return;
}
PlaySoundElseDefault(szSndName,"we_rifle_fire",rvector(x,y,z),bPlayer);
}
}

Step 3. Search for this void ZSoundEngine::playSEReload(MMatchItemDesc *pDesc, float x, float y, float z, bool bPlayer), replace entire function with this:

void ZSoundEngine::playSEReload(MMatchItemDesc *pDesc, float x, float y, float z, bool bPlayer)
{
if( !m_bSoundEnable || !pDesc ) return;

if(pDesc->m_nType.Ref() == MMIT_RANGE)
{
char* szSndName = pDesc->m_szReloadSndName;
if(bPlayer)
{
char szBuffer[64];
//3DSound
if(ZGetConfiguration()->GetAudio()->b3DSound)
{
sprintf( szBuffer, "%s_optional_2d", szSndName );
}
else
{
sprintf( szBuffer, "%s_2d", szSndName );
}
#ifdef _SOUND_LOG
mlog("%s stereo 2d sound is played..\n",szBuffer);
#endif
//3DSound
PlaySoundElseDefault(szSndName,"we_rifle_reload_2d",rvector(x,y,z),bPlayer);
}
PlaySoundElseDefault(szSndName,"we_rifle_reload",rvector(x,y,z),bPlayer);
}
}

Step 4. Open ZConfiguration.cpp, search for childElement.GetChildContents(&m_Audio.b3DSound, ZTOK_AUDIO_3D_SOUND); uncomment, and comment the line below it.

Step 5. In ZConfiguration.cpp, search for CreateChildElement(ZTOK_AUDIO_3D_SOUND), and replace it with this:

parentElement.AppendText("\n\t\t");
aElement = parentElement.CreateChildElement(ZTOK_AUDIO_3D_SOUND);
if(m_Audio.b3DSound==true) strcpy(temp, "true");
else strcpy(temp, "false");
aElement.SetContents(temp);

Step 6. Open ZOptionInterface.cpp, search for Effect3D, , and uncomment the lines related to it


Step 7 (xml work).Decompile your default.mrs, and then open option.xml, search for Effect3d, uncomment it by removing <!-- before it and the --> after it, and replace that code with this code:

<LABEL item="Label" parent="AudioOptionGroup">
<FONT>FONTa9</FONT>
<BOUNDS>
<X>3</X>
<Y>131</Y>
<W>100</W>
<H>24</H>
</BOUNDS>
<TEXT>3D Sound</TEXT>
</LABEL>
<BUTTON item="Effect3D" parent="AudioOptionGroup">
<BUTTONLOOK>Custom1ButtonLook</BUTTONLOOK>
<PUSHBUTTON/>
<BOUNDS>
<X>229</X>
<Y>131</Y>
<W>24</W>
<H>24</H>
</BOUNDS>
<ALIGN>
<HALIGN>right</HALIGN>
</ALIGN>
</BUTTON>

Step 8. Recompile, log in and test, if you have any issues post them here and i'll do my best to assist.

Credits: Andres for the ZSoundEngine edits.
 
Joined
Jan 9, 2009
Messages
614
Reaction score
152
You released a toggle via /sound if i remember correctly, this is a gameoption instead. Not that the /sound wasn't neat, but being able to read the childcontents n stuff so the setting stays enabled or disabled is more efficient. I should've named it 3d sound gameoption instead of toggle, but it was like midnight when i posted this so i was tired.
 
Joined
Jul 11, 2012
Messages
786
Reaction score
190
You released a toggle via /sound if i remember correctly, this is a gameoption instead. Not that the /sound wasn't neat, but being able to read the childcontents n stuff so the setting stays enabled or disabled is more efficient. I should've named it 3d sound gameoption instead of toggle, but it was like midnight when i posted this so i was tired.

what i meant is that I have released a tutorial on how to make a gameoption toggle, and released that /sound, and if people are alittle smart they can merge them together, u probably did that, or u made it in your own.
EVENTUALLY, it's all the same ^^
 
Joined
Jan 9, 2009
Messages
614
Reaction score
152
Well, Andres did the zsoundengine code for me, cuz at the time i was too nooby to do it lol. I then decided to re-enable the original 3dsound button :p you're right if people know what they're doing they coudl actually merge my code and your code together :p. I looked for your tutorial for the gameoption toggle, only thing I saw was the /sound, or was that what you were referring to. The way you structured your sentence made it sound like you released both a gameoption as well as command.
 
Last edited:
Back
Top