3D Sound (easy way)

Results 1 to 7 of 7
  1. #1
    Yaaay! Tannous is offline
    MemberRank
    Jul 2012 Join Date
    KonohaLocation
    840Posts

    3D Sound (easy way)

    Hey again guys, so as title says, it's the ezpz way to make the 3D sound command.
    Imma tell only the files, obviously ya'll know the lines

    ZChat_Cmds.cpp
    Code:
    void ChatCmd_3DSound(const char* line, const int argc, char **const argv);
    Code:
    _CC_AC("sound", &ChatCmd_3DSound, CCF_ALL|CCF_GAME, ARGVNoMin, ARGVNoMax, true, "/sound", "");
    Code:
    void ChatCmd_3DSound(const char* line, const int argc, char **const argv)
    {
    	char szMsg[256];
    	ZCharacter* pCharacter = ZGetGame()->m_pMyCharacter;
    	if(pCharacter->GetStatus().Ref().b3DSound == 0)
    	{
    		pCharacter->GetStatus().CheckCrc();
    		pCharacter->GetStatus().Ref().b3DSound = 1;
    		pCharacter->GetStatus().MakeCrc();
    		sprintf(szMsg, "^23D Sound Enabled");
    	}
    	else if(pCharacter->GetStatus().Ref().b3DSound == 1)
    	{
    		pCharacter->GetStatus().CheckCrc();
    		pCharacter->GetStatus().Ref().b3DSound = 0;
    		pCharacter->GetStatus().MakeCrc();
    		sprintf(szMsg, "^23D Sound Disabled");
    	}
    	ZChatOutput(szMsg);
    }
    ZCharacter.h
    inside the struct ZCharacterStatus
    Code:
    int b3DSound;
    Code:
    b3DSound(0),
    ZSoundEngine.cpp
    in this function: ZSoundEngine::PlaySEFire(MMatchItemDesc *pDesc, float x, float y, float z, bool bPlayer)
    Code:
    Replace:
    sprintf( szBuffer, "%s_2d", szSndName );
    With:
    ZCharacter* pCharacter = ZGetGame()->m_pMyCharacter;
    if(pCharacter->GetStatus().Ref().b3DSound == 0) {
    	sprintf(szBuffer, "%s%s", szSndName, "_2d");
    } else if(pCharacter->GetStatus().Ref().b3DSound == 1) {
    	sprintf(szBuffer, "%s%s", szSndName, "_optional_2d"); 
    }
    Code:
    Replace:
    szDefault = "we_rifle_fire_2d";
    With:
    szDefault = szSndName;
    now this function: ZSoundEngine::PlaySEReload(MMatchItemDesc *pDesc, float x, float y, float z, bool bHero)
    Code:
    Replace:
    sprintf( szBuffer, "%s_2d", szSndName );
    With:
    ZCharacter* pCharacter = ZGetGame()->m_pMyCharacter;
    if(pCharacter->GetStatus().Ref().b3DSound == 0) {
    	sprintf(szBuffer, "%s%s", szSndName, "_2d");
    } else if(pCharacter->GetStatus().Ref().b3DSound == 1) {
    	sprintf(szBuffer, "%s%s", szSndName, "_optional_2d"); 
    }
    ZSoundEngine::PlaySEFire(MMatchItemDesc *pDesc, float x, float y, float z, bool bHero)
    Code:
    Replace:
    sprintf(szFireSndName, "%s%s", szSndName, "_2d");
    With:
    ZCharacter* pCharacter = ZGetGame()->m_pMyCharacter;
    if(pCharacter->GetStatus().Ref().b3DSound == 0)) {
    	sprintf(szBuffer, "%s%s", szSndName, "_2d");
    } else if(pCharacter->GetStatus().Ref().b3DSound == 1) {
            sprintf(szBuffer, "%s%s", szSndName, "_optional_2d"); 
    }
    ZSoundEngine::PlaySEReload(MMatchItemDesc *pDesc, float x, float y, float z, bool bPlayer)
    Code:
    Replace:
    sprintf( szBuffer, "%s_2d", szSndName );
    With:
    ZCharacter* pCharacter = ZGetGame()->m_pMyCharacter;
    if(pCharacter->GetStatus().Ref().b3DSound == 0) {
    	sprintf(szBuffer, "%s%s", szSndName, "_2d");
    } else if(pCharacter->GetStatus().Ref().b3DSound == 1) {
            sprintf(szBuffer, "%s%s", szSndName, "_optional_2d"); 
    }
    Code:
    Replace:
    PlaySoundElseDefault(szBuffer,"we_rifle_reload_2d",rvector(x,y,z),bPlayer);
    With:
    PlaySoundElseDefault(szSndName,"we_rifle_reload_2d",rvector(x,y,z),bPlayer);
    You're good to go, ofcourse everyone knows usage: /sound
    OLD, but easy method for who find it hard to add !
    Thanks & Peace


  2. #2
    Hakuna Matata bulli10 is offline
    MemberRank
    Feb 2011 Join Date
    697Posts

    Re: 3D Sound (easy way)

    Nice release thanks .

  3. #3
    Member skhan is offline
    MemberRank
    Apr 2012 Join Date
    52Posts

    Re: 3D Sound (easy way)

    Good release thank you so much :)

  4. #4
    Retired. Don't PM. SecretsOThePast is offline
    DeveloperRank
    Jan 2009 Join Date
    643Posts

    Re: 3D Sound (easy way)

    Just as an FYI, assigning a variable to a specific ZCharacter/ZMyCharacter means you'll have to re-input the setting every time you leave a game.

    I would put it in the configuration options just like the other settings. Look into how config.xml is loaded.

  5. #5
    Yaaay! Tannous is offline
    MemberRank
    Jul 2012 Join Date
    KonohaLocation
    840Posts

    Re: 3D Sound (easy way)

    Quote Originally Posted by SecretsOThePast View Post
    Just as an FYI, assigning a variable to a specific ZCharacter/ZMyCharacter means you'll have to re-input the setting every time you leave a game.

    I would put it in the configuration options just like the other settings. Look into how config.xml is loaded.
    Exactly you are 100% correct, that's why i said the noobest and ezpz way XD.. just cuz it doens't save...
    and you are rigth again cuz u can put it in configuration options and make it save !
    Thanks for the note, and for passing :D

  6. #6
    Gunz League owner Hakurah is offline
    MemberRank
    Dec 2006 Join Date
    Rio de JaneiroLocation
    602Posts

    Re: 3D Sound (easy way)

    Thanks! This would've saved me a lot of time a couple weeks ago, but I managed to figure it out on my own. It will be great for those who get here from now on.

  7. #7
    Enthusiast T3Setsu is offline
    MemberRank
    Jul 2014 Join Date
    HellLocation
    32Posts

    Re: 3D Sound (easy way)

    Interesting



Advertisement