Example #1
0
/*
======================
CG_StartMusic

======================
*/
void CG_StartMusic( void ) {
	char	*s;
	char	parm1[MAX_QPATH], parm2[MAX_QPATH];

	// start the background music
	s = (char *)CG_ConfigString( CS_MUSIC );
	if ( !s || strlen(s) == 0)
		trap_S_StopBackgroundTrack();
	else {
		Q_strncpyz( parm1, COM_Parse( &s ), sizeof( parm1 ) );
		Q_strncpyz( parm2, COM_Parse( &s ), sizeof( parm2 ) );

		trap_S_StartBackgroundTrack( parm1, parm2 );
	}
}
Example #2
0
/*===============
UI_CreditMenu
===============*/
void UI_CreditMenu( void ) {

	uis.menuamount = 0;
	trap_S_StopBackgroundTrack();
	trap_S_StartBackgroundTrack("music/credits.ogg", "music/credits.ogg");
	trap_S_StartLocalSound( menu_exit_sound, CHAN_LOCAL_SOUND );


	memset( &s_credits, 0 ,sizeof(s_credits) );

	s_credits.menu.draw = UI_CreditMenu_Draw;
	s_credits.menu.key = UI_CreditMenu_Key;
	s_credits.menu.fullscreen = qtrue;
	UI_PushMenu ( &s_credits.menu );
}
Example #3
0
/*
* UI_Shutdown
*/
void UI_Shutdown( void )
{
	trap_S_StopBackgroundTrack();

	trap_Cmd_RemoveCommand( "menu_main" );
	trap_Cmd_RemoveCommand( "menu_main_sbar" );
	trap_Cmd_RemoveCommand( "menu_setup" );
	trap_Cmd_RemoveCommand( "menu_joinserver" );
	trap_Cmd_RemoveCommand( "menu_matchmaker" );
#ifdef AUTH_CODE
	trap_Cmd_RemoveCommand( "menu_login" );
	trap_Cmd_RemoveCommand( "menu_register" );
#endif
	trap_Cmd_RemoveCommand( "menu_playerconfig" );
	trap_Cmd_RemoveCommand( "menu_startserver" );
	trap_Cmd_RemoveCommand( "menu_sound" );
	trap_Cmd_RemoveCommand( "menu_options" );
	trap_Cmd_RemoveCommand( "menu_performance" );
	trap_Cmd_RemoveCommand( "menu_performanceadv" );
	trap_Cmd_RemoveCommand( "menu_keys" );
	trap_Cmd_RemoveCommand( "menu_vsays" );
	trap_Cmd_RemoveCommand( "menu_quit" );
	trap_Cmd_RemoveCommand( "menu_reset" );
	trap_Cmd_RemoveCommand( "menu_demos" );
	trap_Cmd_RemoveCommand( "menu_mods" );
	trap_Cmd_RemoveCommand( "menu_game" );
	trap_Cmd_RemoveCommand( "menu_tv" );
	trap_Cmd_RemoveCommand( "menu_tv_channel_add" );
	trap_Cmd_RemoveCommand( "menu_tv_channel_remove" );
	trap_Cmd_RemoveCommand( "menu_failed" );
	trap_Cmd_RemoveCommand( "menu_msgbox" );
	trap_Cmd_RemoveCommand( "menu_custom" );
	trap_Cmd_RemoveCommand( "menu_teamconfig" );
	trap_Cmd_RemoveCommand( "menu_force" );
	trap_Cmd_RemoveCommand( "menu_tutorials" );
	trap_Cmd_RemoveCommand( "menu_demoplay" );
	trap_Cmd_RemoveCommand( "menu_pop" );
}
Example #4
0
/*
=================
CG_StopMusic_f
=================
*/
void CG_StopMusic_f( void ) {
	trap_S_StopBackgroundTrack();
}
Example #5
0
void CG_StopDeathMusic( void ) {
	trap_S_StopBackgroundTrack();
	cg.deathmusicStarted = qfalse;
	CG_StartMusic();
}
void LaunchMediaViewMenu(const char* mediaRef, const char* execOnClose) {
	int i=0;
	const char* mediafilepath = EMPTY_MEDIAFILEPATH_STRING;

	//TODO? pop the menu if the current one is this one? *ponder*

	memset(&s_mediaview_menu,0,sizeof(mediaview_menu_t));
	s_mediaview_menu.mediatype = MT_UNKNOWN; //note: just to make it clear (I know that memset would also set 0 ;) )

	if(execOnClose && *execOnClose) {
		Q_strncpyz(s_mediaview_menu.execOnClose,execOnClose,sizeof(s_mediaview_menu.execOnClose));
	}

	for(i=0;mediatype_strs[i];++i) {
		if(i!=MT_UNKNOWN) {
			int compLen = strlen(mediatype_strs[i]);

			if(!Q_stricmpn(mediaRef,mediatype_strs[i],compLen)) {
				s_mediaview_menu.mediatype = i;

				mediafilepath = (mediaRef+compLen);

				if(*mediafilepath == '\0')
					mediafilepath = EMPTY_MEDIAFILEPATH_STRING;
			}
		}
	}

	s_mediaview_menu.menu.draw			= MediaView_MenuDraw;
	s_mediaview_menu.menu.key			= MediaView_MenuKey;
	s_mediaview_menu.menu.fullscreen	= qtrue;

	//FIXME: take another texture for the close button (back doesn't fit so good)
	s_mediaview_menu.closeButton.generic.type		= MTYPE_BITMAP;
	s_mediaview_menu.closeButton.generic.name		= "menu/single/continue/start0";
	s_mediaview_menu.closeButton.generic.flags		= QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS;
	s_mediaview_menu.closeButton.generic.callback	= MediaView_CloseAction;
	s_mediaview_menu.closeButton.generic.x			= 640-40;
	s_mediaview_menu.closeButton.generic.y			= 480-40;
	s_mediaview_menu.closeButton.width				= 30;
	s_mediaview_menu.closeButton.height				= 30;
	s_mediaview_menu.closeButton.focuspic			= "menu/single/continue/start1";
	s_mediaview_menu.closeButton.focuspicinstead	= qtrue;

	switch(s_mediaview_menu.mediatype) {
	case MT_PICTURE:
		Com_Printf("[mediaview] loading Comic: %s\n",mediafilepath);

		// set menu cursor to a nice location
		uis.cursorx = 320;
		uis.cursory = 240;

		s_mediaview_menu.comicPic.generic.type		= MTYPE_BITMAP;
		s_mediaview_menu.comicPic.generic.name		= mediafilepath;
		s_mediaview_menu.comicPic.generic.flags		= QMF_LEFT_JUSTIFY | QMF_SILENT;
//		s_mediaview_menu.comicPic.generic.callback	= UI_SecretAction;
		s_mediaview_menu.comicPic.generic.x			= 0;
		s_mediaview_menu.comicPic.generic.y			= 0;
		s_mediaview_menu.comicPic.width				= 640;
		s_mediaview_menu.comicPic.height			= 480;
		Menu_AddItem(&s_mediaview_menu.menu,	&s_mediaview_menu.comicPic);

		Menu_AddItem(&s_mediaview_menu.menu,	&s_mediaview_menu.closeButton);

		break;
	case MT_VIDEO:
		Com_Printf("[mediaview] loading Video: %s\n",mediafilepath);
		s_mediaview_menu.CINhandle = trap_CIN_PlayCinematic(mediafilepath, 0, 0, 640, 480, /*int bits*/ 0);// CIN_loop, CIN_hold
		s_mediaview_menu.menu.noMouseCursor = qtrue;
		trap_S_StopBackgroundTrack();
		break;
	default:
		Com_Printf("[mediaview] Couldn't find a known mediatype in the string: %s\n",mediaRef);
		break;
	}

	UI_PushMenu ( &s_mediaview_menu.menu );
}
Example #7
0
/*
* CG_AddLocalSounds
*/
static void CG_AddLocalSounds( void )
{
	static bool postmatchsound_set = false, demostream = false, background = false;
	static unsigned int lastSecond = 0;

	// add local announces
	if( GS_Countdown() )
	{
		if( GS_MatchDuration() )
		{
			unsigned int duration, curtime, remainingSeconds;
			float seconds;

			curtime = GS_MatchPaused() ? cg.frame.serverTime : cg.time;
			duration = GS_MatchDuration();

			if( duration + GS_MatchStartTime() < curtime )
				duration = curtime - GS_MatchStartTime(); // avoid negative results

			seconds = (float)( GS_MatchStartTime() + duration - curtime ) * 0.001f;
			remainingSeconds = (unsigned int)seconds;

			if( remainingSeconds != lastSecond )
			{
				if( 1 + remainingSeconds < 4 )
				{
					struct sfx_s *sound = trap_S_RegisterSound( va( S_ANNOUNCER_COUNTDOWN_COUNT_1_to_3_SET_1_to_2, 1 + remainingSeconds, 1 ) );
					CG_AddAnnouncerEvent( sound, false );
				}

				lastSecond = remainingSeconds;
			}
		}
	}
	else
		lastSecond = 0;

	// add sounds from announcer
	CG_ReleaseAnnouncerEvents();

	// if in postmatch, play postmatch song
	if( GS_MatchState() >= MATCH_STATE_POSTMATCH )
	{
		if( !postmatchsound_set && !demostream )
		{
			trap_S_StartBackgroundTrack( S_PLAYLIST_POSTMATCH, NULL, 3 ); // loop random track from the playlist
			postmatchsound_set = true;
			background = false;
		}
	}
	else
	{
		if( cgs.demoPlaying && cgs.demoAudioStream && !demostream )
		{
			trap_S_StartBackgroundTrack( cgs.demoAudioStream, NULL, 0 );
			demostream = true;
		}

		if( postmatchsound_set )
		{
			trap_S_StopBackgroundTrack();
			postmatchsound_set = false;
			background = false;
		}

		if( (!postmatchsound_set && !demostream) && !background )
		{
			CG_StartBackgroundTrack();
			background = true;
		}

		// notice: these 2 sound files aren't used anymore
		//cgs.media.sfxTimerBipBip
		//cgs.media.sfxTimerPloink
	}
}