MCPcopy Create free account
hub / github.com/JACoders/OpenJK / AS_UpdateCurrentSet

Function AS_UpdateCurrentSet

code/client/snd_ambient.cpp:968–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966*/
967
968static void AS_UpdateCurrentSet( int id ) {
969 if ( !aSets ) {
970 return;
971 }
972
973 //Check for a change
974 if ( id != currentSet ) {
975 //This is new, so start the fading
976 oldSet = currentSet;
977 currentSet = id;
978
979 ambientSet_t *current = aSets->GetSet( currentSet );
980 // Ste, I just put this null check in for now, not sure if there's a more graceful way to exit this function - dmv
981 if ( !current ) {
982 return;
983 }
984
985 ambientSet_t *old = aSets->GetSet( oldSet );
986 if ( old ) {
987 old->masterVolume = MAX_SET_VOLUME;
988 old->fadeTime = cls.realtime;
989 }
990
991 current->masterVolume = 0;
992
993 //Set the fading starts
994 current->fadeTime = cls.realtime;
995 }
996
997 //Update their volumes if fading
998 AS_UpdateSetVolumes();
999}
1000
1001/*
1002-------------------------

Callers 1

S_UpdateAmbientSetFunction · 0.70

Calls 2

AS_UpdateSetVolumesFunction · 0.70
GetSetMethod · 0.45

Tested by

no test coverage detected