/* =========== ClientDisconnect called when a player disconnects from a server GLOBALS ASSUMED SET: g_fGameOver ============ */ void ClientDisconnect( edict_t *pEntity ) { if (g_fGameOver) return; char text[256]; sprintf( text, "- %s has left the game\n", STRING(pEntity->v.netname) ); MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); WRITE_BYTE( ENTINDEX(pEntity) ); WRITE_STRING( text ); MESSAGE_END(); CSound *pSound; pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( pEntity ) ); { // since this client isn't around to think anymore, reset their sound. if ( pSound ) { pSound->Reset(); } } // since the edict doesn't get deleted, fix it so it doesn't interfere. pEntity->v.takedamage = DAMAGE_NO;// don't attract autoaim pEntity->v.solid = SOLID_NOT;// nonsolid UTIL_SetOrigin ( &pEntity->v, pEntity->v.origin ); g_pGameRules->ClientDisconnected( pEntity ); }
void ManageAudio::playSound(TypeAudio _type) { this->stopSound(_type); std::hash_map<int, CSound*>::iterator it = this->listAudio.find((int)_type); if (it != this->listAudio.end()) { CSound* sound = it->second; if (sound->loop) { sound->Reset(); sound->Play(0, DSBPLAY_LOOPING); //sound->Play(0, DSSCL_PRIORITY); } else { sound->Reset(); sound->Play(); } } }
void CSoundManager::release() { if (m_soundVector.size() > 0) { std::vector<CSound*>::iterator i; for (i = m_soundVector.begin(); i != m_soundVector.end(); i++) { CSound* sound = (*i); sound->Stop(); sound->Reset(); SAFE_DELETE(sound); } m_soundVector.clear(); } SAFE_RELEASE( m_pDS ); }
/* =========== ClientDisconnect called when a player disconnects from a server GLOBALS ASSUMED SET: g_fGameOver ============ */ void ClientDisconnect( edict_t *pEntity ) { // If they're in an arena, remove them CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE(pEntity); if ( pPlayer->m_pCurrentArena ) pPlayer->m_pCurrentArena->RemoveClient( pPlayer ); if (g_fGameOver) return; // char text[256]; // sprintf( text, "- %s has left the game\n", STRING(pEntity->v.netname) ); // MESSAGE_BEGIN( MSG_BROADCAST, gmsgSayText, NULL ); // WRITE_BYTE( ENTINDEX(pEntity) ); // WRITE_STRING( text ); // MESSAGE_END(); // notify other clients the player has left UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Game_disconnected", STRING(pEntity->v.netname) ); CSound *pSound; pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( pEntity ) ); { // since this client isn't around to think anymore, reset their sound. if ( pSound ) { pSound->Reset(); } } // since the edict doesn't get deleted, fix it so it doesn't interfere. pEntity->v.takedamage = DAMAGE_NO;// don't attract autoaim pEntity->v.solid = SOLID_NOT;// nonsolid UTIL_SetOrigin ( &pEntity->v, pEntity->v.origin ); g_pGameRules->ClientDisconnected( pEntity ); pPlayer->m_bHasDisconnected = true; }