Esempio n. 1
0
/*
=================
UI_Init
=================
*/
void UI_Init( int apiVersion, uiimport_t *uiimport, qboolean inGameLoad )
{
	ui = *uiimport;

	if ( apiVersion != UI_API_VERSION ) {
		ui.Error( ERR_FATAL, "Bad UI_API_VERSION: expected %i, got %i\n", UI_API_VERSION, apiVersion );
	}

	// get static data (glconfig, media)
	ui.GetGlconfig( &uis.glconfig );

	uis.scaley = uis.glconfig.vidHeight * (1.0/480.0);
	uis.scalex = uis.glconfig.vidWidth * (1.0/640.0);

	Menu_Cache( );

	ui.Cvar_Create( "cg_drawCrosshair", "1", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE );
	ui.Cvar_Create ("s_language",			"english",	CVAR_ARCHIVE | CVAR_NORESTART);
#ifndef JK2_MODE
	ui.Cvar_Create( "g_char_model",			"jedi_tf",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_char_skin_head",		"head_a1",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_char_skin_torso",	"torso_a1",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_char_skin_legs",		"lower_a1",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_char_color_red",		"255",		CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_char_color_green",	"255",		CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_char_color_blue",	"255",		CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_saber_type",			"single",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_saber",				"single_1",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_saber2",				"",			CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_saber_color",		"yellow",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );
	ui.Cvar_Create( "g_saber2_color",		"yellow",	CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART );

	ui.Cvar_Create( "ui_forcepower_inc",	"0",		CVAR_ROM|CVAR_SAVEGAME|CVAR_NORESTART);
	ui.Cvar_Create( "tier_storyinfo",		"0",		CVAR_ROM|CVAR_SAVEGAME|CVAR_NORESTART);
	ui.Cvar_Create( "tiers_complete",		"",			CVAR_ROM|CVAR_SAVEGAME|CVAR_NORESTART);
	ui.Cvar_Create( "ui_prisonerobj_currtotal", "0",	CVAR_ROM|CVAR_SAVEGAME|CVAR_NORESTART);
	ui.Cvar_Create( "ui_prisonerobj_mintotal",  "0",	CVAR_ROM|CVAR_SAVEGAME|CVAR_NORESTART);

	ui.Cvar_Create( "g_dismemberment", "3", CVAR_ARCHIVE );//0 = none, 1 = arms and hands, 2 = legs, 3 = waist and head
	ui.Cvar_Create( "cg_gunAutoFirst", "1", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE );
	ui.Cvar_Create( "g_subtitles", "0", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE );
	ui.Cvar_Create( "d_slowmodeath", "3", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_shadows", "1", CVAR_ARCHIVE );

	ui.Cvar_Create( "cg_runpitch", "0.002", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_runroll", "0.005", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_bobup", "0.005", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_bobpitch", "0.002", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_bobroll", "0.002", CVAR_ARCHIVE );

	ui.Cvar_Create( "ui_disableWeaponSway", "0", CVAR_ARCHIVE );
#endif



	_UI_Init(inGameLoad);
}
Esempio n. 2
0
/*
=================
UI_Init
=================
*/
void UI_Init( int apiVersion, uiimport_t *uiimport ) 
{
	gameinfo_import_t	gameinfo_import;

	ui = *uiimport;

	if ( apiVersion != UI_API_VERSION ) {
		ui.Error( ERR_FATAL, "Bad UI_API_VERSION: expected %i, got %i\n", UI_API_VERSION, apiVersion );
	}

	_UI_Init(qfalse);

	// get static data (glconfig, media)
	ui.GetGlconfig( &uis.glconfig );

	uis.scaley = uis.glconfig.vidHeight * (1.0/480.0);
	uis.scalex = uis.glconfig.vidWidth * (1.0/640.0);

	gameinfo_import.FS_FOpenFile = ui.FS_FOpenFile;
	gameinfo_import.FS_Read = ui.FS_Read;
	gameinfo_import.FS_ReadFile = ui.FS_ReadFile;
	gameinfo_import.FS_FreeFile = ui.FS_FreeFile;
	gameinfo_import.FS_FCloseFile = ui.FS_FCloseFile;
	gameinfo_import.Cvar_Set = ui.Cvar_Set;
	gameinfo_import.Cvar_VariableStringBuffer = ui.Cvar_VariableStringBuffer;
	gameinfo_import.Cvar_Create = ui.Cvar_Create;
	gameinfo_import.Printf = ui.Printf;
//	GI_Init( &gameinfo_import );

	Menu_Cache( );

	ui.Cvar_Create( "cg_drawCrosshair", "1", CVAR_ARCHIVE );
	ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE );
	ui.Cvar_Create ("s_language", "english", CVAR_ARCHIVE | CVAR_NORESTART);
}
Esempio n. 3
0
/*
=================
UI_SetActiveMenu -
	this should be the ONLY way the menu system is brought up

=================
*/
void UI_SetActiveMenu( const char* menuname,const char *menuID )
{
	// this should be the ONLY way the menu system is brought up (besides the UI_ConsoleCommand below)

	if (cls.state != CA_DISCONNECTED && !ui.SG_GameAllowedToSaveHere(qtrue))	//don't check full sytem, only if incamera
	{
		return;
	}

	if ( !menuname ) {
		UI_ForceMenuOff();
		return;
	}

	//make sure force-speed and slowmodeath doesn't slow down menus - NOTE: they should reset the timescale when the game un-pauses
	Cvar_SetValue( "timescale", 1.0f );

	UI_Cursor_Show(qtrue);

	// enusure minumum menu data is cached
	Menu_Cache();

	if ( Q_stricmp (menuname, "mainMenu") == 0 )
	{
		UI_MainMenu();
		return;
	}

	if ( Q_stricmp (menuname, "ingame") == 0 )
	{
		ui.Cvar_Set( "cl_paused", "1" );
		UI_InGameMenu(menuID);
		return;
	}

	if ( Q_stricmp (menuname, "datapad") == 0 )
	{
		ui.Cvar_Set( "cl_paused", "1" );
		UI_DataPadMenu();
		return;
	}
#ifndef JK2_MODE
	if ( Q_stricmp (menuname, "missionfailed_menu") == 0 )
	{
		Menus_CloseAll();
		Menus_ActivateByName("missionfailed_menu");
		ui.Key_SetCatcher( KEYCATCH_UI );
		return;
	}
#endif
}
Esempio n. 4
0
qboolean UI_ConsoleCommand( void )
{
	char	*cmd;

	if (!ui.SG_GameAllowedToSaveHere(qtrue))	//only check if incamera
	{
		return qfalse;
	}

	cmd = UI_Argv( 0 );

	// ensure minimum menu data is available
	Menu_Cache();

	if ( Q_stricmp (cmd, "ui_cache") == 0 )
	{
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "levelselect") == 0 )
	{
		UI_LoadMenu_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_teamOrders") == 0 )
	{
		UI_SaveMenu_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_report") == 0 )
	{
		UI_Report();
		return qtrue;
	}

#ifndef JK2_MODE
	if ( Q_stricmp (cmd, "ui_load") == 0 )
	{
		UI_Load();
		return qtrue;
	}
#endif

	return qfalse;
}
Esempio n. 5
0
/*
=================
UI_Cache
=================
*/
static void UI_Cache_f( void )
{
	Menu_Cache();
#ifndef JK2_MODE
extern const char *lukeForceStatusSounds[];
extern const char *kyleForceStatusSounds[];
	for (int index = 0; index < 5; index++)
	{
		DC->registerSound(lukeForceStatusSounds[index], qfalse);
		DC->registerSound(kyleForceStatusSounds[index], qfalse);
	}
	for (int index = 1; index <= 18; index++)
	{
		DC->registerSound(va("sound/chars/storyinfo/%d",index), qfalse);
	}
	trap_S_RegisterSound("sound/chars/kyle/04kyk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/kyle/05kyk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/kyle/07kyk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/kyle/14kyk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/kyle/21kyk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/kyle/24kyk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/kyle/25kyk001.mp3", qfalse);

	trap_S_RegisterSound("sound/chars/luke/06luk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/luke/08luk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/luke/22luk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/luke/23luk001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/protocol/12pro001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/protocol/15pro001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/protocol/16pro001.mp3", qfalse);
	trap_S_RegisterSound("sound/chars/wedge/13wea001.mp3", qfalse);


	Menus_ActivateByName("ingameMissionSelect1");
	Menus_ActivateByName("ingameMissionSelect2");
	Menus_ActivateByName("ingameMissionSelect3");
#endif
}
Esempio n. 6
0
/*
========================
UI_DrawConnectScreen

This will also be overlaid on the cgame info screen during loading
to prevent it from blinking away too rapidly on local or lan games.
========================
*/
void UI_DrawConnectScreen( qboolean overlay ) {
	char			*s;
	uiClientState_t	cstate;
	char			info[MAX_INFO_VALUE];

	Menu_Cache();

	if ( !overlay ) {
		// draw the dialog background
		UI_SetColor( color_white );
		UI_DrawHandlePic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, uis.connecting );
	}

	// see what information we should display
	trap_GetClientState( &cstate );

	info[0] = '\0';
	if( trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ) ) {
		UI_DrawProportionalString( 320, 16, va( "Loading %s", Info_ValueForKey( info, "mapname" ) ), UI_BIGFONT|UI_CENTER|UI_DROPSHADOW, 1.0, g_color_table[60] );
	}

	UI_DrawProportionalString( 320, 64, va("Connecting to %s", cstate.servername), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, g_color_table[60] );
	//UI_DrawProportionalString( 320, 96, "Press Esc to abort", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color );

	// display global MOTD at bottom
	UI_DrawProportionalString( SCREEN_WIDTH/2, SCREEN_HEIGHT-32, 
		Info_ValueForKey( cstate.updateInfoString, "motd" ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, menu_text_color );
	
	// print any server info (server full, bad version, etc)
	if ( cstate.connState < CA_CONNECTED ) {
		UI_DrawProportionalString_AutoWrapped( 320, 192, 630, 20, cstate.messageString, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color );
		//Here is what prints the ban message!
		//Com_Printf("DBG: %s\n", cstate.messageString);
	}

#if 0
	// display password field
	if ( passwordNeeded ) {
		s_ingame_menu.x = SCREEN_WIDTH * 0.50 - 128;
		s_ingame_menu.nitems = 0;
		s_ingame_menu.wrapAround = qtrue;

		passwordField.generic.type = MTYPE_FIELD;
		passwordField.generic.name = "Password:"******"password"), 
			sizeof(passwordField.field.buffer) );

		Menu_AddItem( &s_ingame_menu, ( void * ) &s_customize_player_action );

		MField_Draw( &passwordField );
	}
#endif

	if ( lastConnState > cstate.connState ) {
		lastLoadingText[0] = '\0';
	}
	lastConnState = cstate.connState;

	switch ( cstate.connState ) {
	case CA_CONNECTING:
		s = va("Awaiting challenge...%i", cstate.connectPacketCount);
		break;
	case CA_CHALLENGING:
		s = va("Awaiting connection...%i", cstate.connectPacketCount);
		break;
	case CA_CONNECTED: {
		char downloadName[MAX_INFO_VALUE];

			trap_Cvar_VariableStringBuffer( "cl_downloadName", downloadName, sizeof(downloadName) );
			if (*downloadName) {
				UI_DisplayDownloadInfo( downloadName );
				return;
			}
		}
		s = "Awaiting gamestate...";
		break;
	case CA_LOADING:
		return;
	case CA_PRIMED:
		return;
	default:
		return;
	}

	UI_DrawProportionalString( 320, 128, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, g_color_table[60] );

	// password required / connection rejected information goes here
}
Esempio n. 7
0
/*
=================
UI_Cache
=================
*/
static void UI_Cache_f( void ) 
{
	Menu_Cache();
}
Esempio n. 8
0
/*
========================
UI_DrawConnectText

This will also be overlaid on the cgame info screen during loading
to prevent it from blinking away too rapidly on local or lan games.
matches CG_DrawInformation from cg_info.cpp.
========================
*/
void UI_DrawConnectText( const char *servername, const char *updateInfoString ) {
	char		*s;
	connstate_t	connState;
//	char			info[MAX_INFO_VALUE];
	int			textX,textY;
	int padY;

	Menu_Cache();

	connState = ui.GetClientState();

//	ui.R_SetColor( colorTable[CT_DKPURPLE2]);

//	info[0] = '\0';
//	ui.GetConfigString( CS_SERVERINFO, info, sizeof(info) );
//	if( info[0] ) 
//	{
//		UI_DrawProportionalString( 320, 16, va( "%s %s",menu_normal_text[MNT_TRANSPORTING], Info_ValueForKey( info, "mapname" ) ), UI_SMALLFONT|UI_CENTER, colorTable[CT_LTGOLD1] );
//		UI_DrawProportionalString( 320, 16, va( "%s ...",menu_normal_text[MNT_TRANSPORTING] ), UI_SMALLFONT|UI_CENTER, colorTable[CT_LTGOLD1] );
//	}

//	UI_DrawString( 16, 10, va("Connecting to %s", servername), UI_LEFT|UI_BIGFONT, menu_text_color );
//	UI_DrawString( 16, 26, "Press Esc to abort", UI_LEFT|UI_BIGFONT, menu_text_color );

	// display global MOTD at bottom
	UI_DrawString( SCREEN_WIDTH/2, SCREEN_HEIGHT-20, Info_ValueForKey( updateInfoString, "motd" ), UI_CENTER|UI_BIGFONT, menu_text_color );

	// print any server info
	if ( connState < CA_CONNECTED ) {
		UI_DrawString( 16, 160, connectionMessageString, UI_LEFT|UI_BIGFONT, menu_text_color );
	}


	if ( connState == CA_CONNECTING ) {
		s = connectionDialogString;		// try number
	} else {
		s = "";
	}

	textX = 267;
	textY = 270;
	padY = 24;

	// Awaiting callenge
	UI_DrawProportionalString(  textX,  textY, va("%s...%s",menu_normal_text[MNT_TARGETINGSCANNERS], s),UI_SMALLFONT, colorTable[CT_LTGOLD1]);
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicEmptyCircle2);

	if ( connState == CA_CONNECTING ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}

	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicCircle2);

	if ( connState == CA_CHALLENGING ) {
		s = connectionDialogString;		// try number
	} else {
		s = "";
	}

	// Awaiting connection
	textY += padY;
	UI_DrawProportionalString(  textX,  textY, va("%s...%s",menu_normal_text[MNT_SCANNINGAREA], s),UI_SMALLFONT, colorTable[CT_LTGOLD1]);
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicEmptyCircle2);
	if ( connState == CA_CHALLENGING ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicCircle2);

	// Awaiting gamestate
	textY += padY;
	UI_DrawProportionalString(  textX,  textY, va("%s...",menu_normal_text[MNT_CONFIRMINGBEAMIN]),UI_SMALLFONT, colorTable[CT_LTGOLD1]);
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicEmptyCircle2);
	if ( connState == CA_CONNECTED ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicCircle2);

	// Loading
	textY += padY;
	UI_DrawProportionalString(  textX,  textY, va("%s...",menu_normal_text[MNT_LOCKINGPOSTION]),UI_SMALLFONT, colorTable[CT_LTGOLD1]);
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicEmptyCircle2);
	if ( connState == CA_LOADING ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicCircle2);

	// Awaiting snap shot
	textY += padY;
	UI_DrawProportionalString(  textX, textY, va("%s . . .",menu_normal_text[MNT_INITIATINGTRANSPORT]),UI_SMALLFONT, colorTable[CT_LTGOLD1]);
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicEmptyCircle2);
	if ( connState == CA_PRIMED ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}
	ui.R_SetColor( colorTable[CT_LTGOLD1]);	
	UI_DrawHandlePic(textX - 24,textY + 1, 16, 16, uis.graphicCircle2);

}
Esempio n. 9
0
/*
========================
UI_DrawConnectText

This will also be overlaid on the cgame info screen during loading
to prevent it from blinking away too rapidly on local or lan games.
matches CG_DrawInformation from cg_info.cpp.
========================
*/
void UI_DrawConnectText( const char *servername, const char *updateInfoString ) {
	char		*s;
	connstate_t	connState;
//	char		info[MAX_INFO_VALUE];
	int			textX,textY;
	int			padY,yPos,xLength;

	Menu_Cache();

	connState = ui.GetClientState();

	yPos = 450;
	xLength = 114;

	// display global MOTD at bottom
//	UI_DrawString( SCREEN_WIDTH/2, SCREEN_HEIGHT-20, Info_ValueForKey( updateInfoString, "motd" ), UI_CENTER|UI_BIGFONT, menu_text_color );

	// print any server info
	if ( connState < CA_CONNECTED ) {
//		UI_DrawString( 16, 160, connectionMessageString, UI_LEFT|UI_BIGFONT, menu_text_color );
	}


	if ( connState == CA_CONNECTING ) {
		s = connectionDialogString;		// try number
	} else {
		s = "";
	}

	textX = 267;
	textY = 270;
	padY = 24;

	// Awaiting callenge
	if ( connState == CA_CONNECTING ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}

	if ( connState == CA_CHALLENGING ) {
		s = connectionDialogString;		// try number
	} else {
		s = "";
	}

	// Awaiting connection
	textY += padY;
	if ( connState == CA_CHALLENGING ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}


	// Awaiting gamestate
	textY += padY;
	if ( connState == CA_CONNECTED ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}

	// Loading
	textY += padY;
	if ( connState == CA_LOADING ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}

	// Awaiting snap shot
	textY += padY;
	if ( connState == CA_PRIMED ) 
	{
		ui.R_SetColor( colorTable[CT_WHITE]);	
		return;
	}

}