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

Function S_CheckDynamicMusicState

code/client/snd_dma.cpp:4860–4917  ·  view source on GitHub ↗

scan the configstring to see if there's been a state-change requested... (note that even if the state doesn't change it still gets here, so do a same-state check for applying) then go on to do transition handling etc...

Source from the content-addressed store, hash-verified

4858// then go on to do transition handling etc...
4859//
4860static void S_CheckDynamicMusicState(void)
4861{
4862 const char *psCommand = S_Music_GetRequestedState();
4863
4864 if (psCommand)
4865 {
4866 MusicState_e eNewState;
4867
4868 if ( !Q_stricmpn( psCommand, "silence", 7) )
4869 {
4870 eNewState = eBGRNDTRACK_SILENCE;
4871 }
4872 else if ( !Q_stricmpn( psCommand, "action", 6) )
4873 {
4874 eNewState = eBGRNDTRACK_ACTION;
4875 }
4876 else if ( !Q_stricmpn( psCommand, "boss", 4) )
4877 {
4878 // special case, boss music is optional and may not be defined...
4879 //
4880 if (tMusic_Info[ eBGRNDTRACK_BOSS ].bExists)
4881 {
4882 eNewState = eBGRNDTRACK_BOSS;
4883 }
4884 else
4885 {
4886 // ( leave it playing current track )
4887 //
4888 eNewState = eMusic_StateActual;
4889 }
4890 }
4891 else if ( !Q_stricmpn( psCommand, "death", 5) )
4892 {
4893 // special case, death music is optional and may not be defined...
4894 //
4895 if (tMusic_Info[ eBGRNDTRACK_DEATH ].bExists)
4896 {
4897 eNewState = eBGRNDTRACK_DEATH;
4898 }
4899 else
4900 {
4901 // ( leave it playing current track, typically either boss or action )
4902 //
4903 eNewState = eMusic_StateActual;
4904 }
4905 }
4906 else
4907 {
4908 // seems a reasonable default...
4909 //
4910 eNewState = eBGRNDTRACK_EXPLORE;
4911 }
4912
4913 S_SetDynamicMusicState( eNewState );
4914 }
4915
4916 S_HandleDynamicMusicStateChange();
4917}

Callers 1

S_UpdateBackgroundTrackFunction · 0.70

Calls 4

Q_stricmpnFunction · 0.85
S_SetDynamicMusicStateFunction · 0.70

Tested by

no test coverage detected