void CG_LimboMenu_f( void ) {
	if( cg.showGameView ) {
		CG_EventHandling( CGAME_EVENT_NONE, qfalse );
	} else {
		CG_EventHandling( CGAME_EVENT_GAMEVIEW, qfalse );
	}
}
static void CG_QuickFireteams_f( void ) {
	if( cg.showFireteamMenu ) {
		if( cgs.ftMenuMode == 0 ) {
			CG_EventHandling( CGAME_EVENT_NONE, qfalse );
		} else {
			cgs.ftMenuMode = 0;
		}
	} else if( CG_IsOnFireteam( cg.clientNum ) ) {
		CG_EventHandling( CGAME_EVENT_FIRETEAMMSG, qfalse );
		cgs.ftMenuMode = 0;
	}
}
void CG_QuickFireteamAdmin_f( void ) {
	trap_UI_Popup( UIMENU_NONE );
	
	if( cg.showFireteamMenu ) {
		if( cgs.ftMenuMode == 1 ) {
			CG_EventHandling( CGAME_EVENT_NONE, qfalse );
		} else {
			cgs.ftMenuMode = 1;
		}
	} else if( cgs.clientinfo[ cg.clientNum ].team != TEAM_SPECTATOR ) {
		CG_EventHandling( CGAME_EVENT_FIRETEAMMSG, qfalse );
		cgs.ftMenuMode = 1;
	}
}
Beispiel #4
0
/*
================
vmMain

This is the only way control passes into the module.
This must be the very first function compiled into the .q3vm file
================
*/
Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  ) {

	switch ( command ) {
	case CG_INIT:
		CG_Init( arg0, arg1, arg2 );
		return 0;
	case CG_SHUTDOWN:
		CG_Shutdown();
		return 0;
	case CG_CONSOLE_COMMAND:
		return CG_ConsoleCommand();
	case CG_DRAW_ACTIVE_FRAME:
		CG_DrawActiveFrame( arg0, arg1, arg2 );
		return 0;
	case CG_CROSSHAIR_PLAYER:
		return CG_CrosshairPlayer();
	case CG_LAST_ATTACKER:
		return CG_LastAttacker();
	case CG_KEY_EVENT:
		CG_KeyEvent(arg0, arg1);
		return 0;
	case CG_MOUSE_EVENT:
		CG_MouseEvent(arg0, arg1);
		return 0;
	case CG_EVENT_HANDLING:
		CG_EventHandling(arg0);
		return 0;
	default:
		CG_Error( "vmMain: unknown command %i", command );
		break;
	}
	return -1;
}
Beispiel #5
0
qboolean CG_LoadPanel_ContinueButtonKeyDown( panel_button_t* button, int key ) {
	if( key == K_MOUSE1 ) {
		CG_EventHandling( CGAME_EVENT_GAMEVIEW, qfalse );
		return qtrue;
	}

	return qfalse;
}
Beispiel #6
0
void CG_keyOff_f(void)
{
	if (!cg.demoPlayback)
	{
		return;
	}
	CG_EventHandling(CGAME_EVENT_NONE, qfalse);
}
Beispiel #7
0
// Toggle all views
void CG_mvToggleAll_f(void)
{
	if (!cg.demoPlayback)
	{
		trap_SendClientCommand((cg.mvTotalClients > 0) ? "mvnone\n" : "mvall\n");

		if (cg.mvTotalClients > 0)
		{
			CG_EventHandling(-CGAME_EVENT_MULTIVIEW, qfalse);
		}
	}
}
Beispiel #8
0
void CG_KeyEvent(int key, qboolean down) {
	switch(cgs.eventHandling) {
		// Demos get their own keys
		case CGAME_EVENT_DEMO:
			CG_DemoClick(key, down);
			return;

		case CGAME_EVENT_CAMPAIGNBREIFING:
			CG_LoadPanel_KeyHandling( key, down );
			break;

		case CGAME_EVENT_FIRETEAMMSG:
			CG_Fireteams_KeyHandling( key, down );
			break;

		case CGAME_EVENT_GAMEVIEW:
			CG_LimboPanel_KeyHandling( key, down );
			break;

		case CGAME_EVENT_SPEAKEREDITOR:
			CG_SpeakerEditor_KeyHandling( key, down );
			break;

		// forty - visual hud editor
		case CGAME_EVENT_HUDEDITOR:
			CG_HudEditor_KeyHandling( key, down );
			break;
	
		// forty - multiview key handler
		case CGAME_EVENT_MULTIVIEW:
			CG_mv_KeyHandling( key, down );
			break;

		default:
			if( cg.snap->ps.pm_type == PM_INTERMISSION ) {
				CG_Debriefing_KeyEvent( key, down );
				return;
			}

			// default handling
			if( !down ) {
				return;
			}

			if ( ( cg.predictedPlayerState.pm_type == PM_NORMAL ||
				(cg.predictedPlayerState.pm_type == PM_SPECTATOR && cg.showScores == qfalse))) {

				CG_EventHandling(CGAME_EVENT_NONE, qfalse);
				return;
			}
			break;
	}
}
void CG_keyOn_f(void)
{
	if(!cg.demoPlayback) {
		CG_Printf("[cgnotify]^3*** NOT PLAYING A DEMO!!\n");
		return;
	}

	if(demo_infoWindow.integer > 0) {
		CG_ShowHelp_On(&cg.demohelpWindow);
	}

	CG_EventHandling(CGAME_EVENT_DEMO, qtrue);
}
Beispiel #10
0
void CG_QuickMessage_f(void)
{
	CG_EventHandling(CGAME_EVENT_NONE, qfalse);

	if (cg_quickMessageAlt.integer)
	{
		trap_UI_Popup(UIMENU_WM_QUICKMESSAGEALT);
	}
	else
	{
		trap_UI_Popup(UIMENU_WM_QUICKMESSAGE);
	}
}
void CG_QuickFireteamMessage_f( void ) {
	if( cgs.clientinfo[ cg.clientNum ].team == TEAM_SPECTATOR ) {
		return;
	}

	CG_EventHandling( CGAME_EVENT_NONE, qfalse );

	if( cg_quickMessageAlt.integer ) {
		trap_UI_Popup( UIMENU_WM_FTQUICKMESSAGEALT );
	} else {
		trap_UI_Popup( UIMENU_WM_FTQUICKMESSAGE );
	}
}
Beispiel #12
0
void CG_QuickMessage_f( void ) {
	if( cgs.clientinfo[ cg.clientNum ].team == TEAM_SPECTATOR &&
		cgs.etpub < ETPUB_VERSION(0,7,0) ) {
		return;
	}

	CG_EventHandling( CGAME_EVENT_NONE, qfalse );

	if( cg_quickMessageAlt.integer ) {
		trap_UI_Popup( UIMENU_WM_QUICKMESSAGEALT );
	} else {
		trap_UI_Popup( UIMENU_WM_QUICKMESSAGE );
	}
}
Beispiel #13
0
void CG_LimboPanel_KeyHandling(int key, qboolean down) {
	int b1, b2;

	if (BG_PanelButtonsKeyEvent(key, down, limboPanelButtons)) {
		return;
	}

	if (down) {
		cgDC.getKeysForBinding("openlimbomenu", &b1, &b2);
		if ((b1 != -1 && b1 == key) || (b2 != -1 && b2 == key)) {
			CG_EventHandling(CGAME_EVENT_NONE, qfalse);
			return;
		}
	}
}
Beispiel #14
0
/*
================
vmMain

This is the only way control passes into the module.
This must be the very first function compiled into the .q3vm file
================
*/
intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  ) {

	switch ( command ) {
	case CG_INIT:
		CG_Init( arg0, arg1, arg2, arg3 );
		return 0;
	case CG_SHUTDOWN:
		CG_Shutdown();
		return 0;
	case CG_CONSOLE_COMMAND:
		return CG_ConsoleCommand();
	case CG_DRAW_ACTIVE_FRAME:
		CG_DrawActiveFrame( arg0, arg1, arg2 );
		return 0;
	case CG_DRAW_2D:
		CG_Draw2D( arg0, arg1, arg2 );
		return 0;
	case CG_CROSSHAIR_PLAYER:
		return CG_CrosshairPlayer();
	case CG_LAST_ATTACKER:
		return CG_LastAttacker();
	case CG_KEY_EVENT:
		CG_KeyEvent(arg0, arg1);
		return 0;
	case CG_MOUSE_EVENT:
		CG_MouseEvent(arg0, arg1);
		return 0;
	case CG_EVENT_HANDLING:
		CG_EventHandling(arg0);
		return 0;
	case CG_CENTERPRINT:
		CG_CenterPrint( (const char*)arg0, 200, 10 );
		return 0;
	case CG_LOCATIONPRINT:
		CG_LocationPrint( (const char*)arg0, arg1, arg2, 10 );
		return 0;
	case CG_PARSEMSG:
		CG_ParseCGMessage();
		return 0;
	default:
		CG_Error( "vmMain: unknown command %i", command );
		break;
	}
	return -1;
}
Beispiel #15
0
void CG_KeyEvent(int key, qboolean down) {

	if (!down) {
		return;
	}

	if ( CG_ChatboxActive() ) {
			 if ( key == K_ENTER ||
				 key == K_KP_ENTER )	CG_ChatboxOutgoing();
		else if ( key == K_TAB )		CG_ChatboxTabComplete();
		else if ( key == K_PGDN )		CG_ChatboxScroll( 0 );
		else if ( key == K_PGUP )		CG_ChatboxScroll( 1 );
		else if ( key == K_UPARROW )	CG_ChatboxHistoryUp();
		else if ( key == K_DOWNARROW )	CG_ChatboxHistoryDn();
		else if ( key == K_BACKSPACE )	CG_ChatboxClear();
		else if ( key == K_ESCAPE )		CG_ChatboxEscape();
		else if ( key & K_CHAR_FLAG )	CG_ChatboxChar( (char)(key & ~K_CHAR_FLAG) );
		return;
	}

	if ( cg.predictedPlayerState.pm_type == PM_NORMAL || (cg.predictedPlayerState.pm_type == PM_SPECTATOR && cg.showScores == qfalse)) {
		CG_EventHandling(CGAME_EVENT_NONE);
		trap->Key_SetCatcher(0);
		return;
	}

	//if (key == trap->Key_GetKey("teamMenu") || !Display_CaptureItem(cgs.cursorX, cgs.cursorY)) {
	// if we see this then we should always be visible
	//  CG_EventHandling(CGAME_EVENT_NONE);
	//  trap->Key_SetCatcher(0);
	//}



	Display_HandleKey(key, down, (int)cgs.cursorX, (int)cgs.cursorY);

	if (cgs.capturedItem) {
		cgs.capturedItem = NULL;
	}	else {
		if (key == K_MOUSE2 && down) {
			cgs.capturedItem = Display_CaptureItem((int)cgs.cursorX, (int)cgs.cursorY);
		}
	}
}
Beispiel #16
0
qboolean CG_LimboPanel_CancelButton_KeyDown(panel_button_t *button, int key) {
	// Nico, silent GCC
	(void)button;

	if (key == K_MOUSE1) {
		SOUND_CANCEL;

		if (cgs.limboLoadoutModified) {
			trap_SendClientCommand("rs");

			cgs.limboLoadoutSelected = qfalse;
		}

		CG_EventHandling(CGAME_EVENT_NONE, qfalse);

		return qtrue;
	}
	return qfalse;
}
Beispiel #17
0
///////////////////////////////
// Create a new view window
//
void CG_mvCreate( int pID )
{
	cg_window_t *w;

	if ( CG_mvClientLocate( pID ) != NULL )
	{
		return;
	}

	w = CG_windowAlloc( WFX_MULTIVIEW, 100 );

	if ( w == NULL )
	{
		return;
	}

	// Window specific
	w->id = WID_NONE;
	w->x = ( cg.mv_cnt == 0 ) ? 0 : 30 + ( 12 * pID );
	w->y = ( cg.mv_cnt == 0 ) ? 0 : 300 + ( 5 * pID );
	w->w = ( cg.mv_cnt == 0 ) ? 640 : 128;
	w->h = ( cg.mv_cnt == 0 ) ? 480 : 96;
	w->mvInfo = ( pID & MV_PID ) | MV_SELECTED;
	w->state = ( cg.mv_cnt == 0 ) ? WSTATE_COMPLETE : WSTATE_START;

	if ( cg.mv_cnt == 0 )
	{
		cg.mvCurrentMainview = w;
		cg.mvCurrentActive = cg.mvCurrentMainview;

		if ( cg_specHelp.integer > 0 && !cg.demoPlayback )
		{
			CG_ShowHelp_On( &cg.spechelpWindow );
			CG_EventHandling( CGAME_EVENT_MULTIVIEW, qfalse );
		}
	}

	cg.mv_cnt++;
}
Beispiel #18
0
void CG_KeyEvent(int key, qboolean down) {
	switch ((int)cgs.eventHandling) {
	// Demos get their own keys
	case CGAME_EVENT_DEMO:
		CG_DemoClick(key, down);
		return;

	case CGAME_EVENT_CAMPAIGNBREIFING:
		CG_LoadPanel_KeyHandling(key, down);
		break;

	case CGAME_EVENT_FIRETEAMMSG:
		CG_Fireteams_KeyHandling(key, down);
		break;

	case CGAME_EVENT_GAMEVIEW:
		CG_LimboPanel_KeyHandling(key, down);
		break;

	case CGAME_EVENT_SPEAKEREDITOR:
		CG_SpeakerEditor_KeyHandling(key, down);
		break;

	default:
		// default handling
		if (!down) {
			return;
		}

		if (cg.predictedPlayerState.pm_type == PM_NORMAL ||
		     (cg.predictedPlayerState.pm_type == PM_SPECTATOR && cg.showScores == qfalse)) {

			CG_EventHandling(CGAME_EVENT_NONE, qfalse);
			return;
		}
		break;
	}
}
Beispiel #19
0
// kw: TODO: make this menu dynamic, showing spawnpoint names
void CG_SpawnSelectMenu_f(void) {
	CG_EventHandling( CGAME_EVENT_NONE, qfalse );
	trap_UI_Popup( UIMENU_WM_SPAWNALT );
	trap_SendConsoleCommand( "vstr select_spawnpoint;");
}
Beispiel #20
0
void CG_ClassSelectMenu_f(void) {
	CG_EventHandling( CGAME_EVENT_NONE, qfalse );
	trap_UI_Popup( UIMENU_WM_CLASSALT );
	trap_SendConsoleCommand( "vstr select_class;");
}
Beispiel #21
0
qboolean CG_FireteamCheckExecKey(int key, qboolean doaction)
{
	if (key == K_ESCAPE)
	{
		return qtrue;
	}

	if ((key & K_CHAR_FLAG))
	{
		return qfalse;
	}

	key &= ~K_CHAR_FLAG;

	switch (cgs.ftMenuMode)
	{
		case 0:
			if (cgs.ftMenuPos == -1)
			{
				if (cg_quickMessageAlt.integer)
				{
					if (key >= '0' && key <= '9')
					{
						int             i = ((key - '0') + 9) % 10;

						if (i < 5)
						{
							if (!CG_FireteamHasClass(i, qtrue))
							{
								return qfalse;
							}
						}

						if (i > 7)
						{
							return qfalse;
						}

						if (doaction)
						{
							if (i < 5)
							{
								cgs.ftMenuPos = i;
							}
							else if (i == 5)
							{
								CG_QuickFireteamMessage_f();
							}
							else
							{
								trap_SendClientCommand(va
								                       ("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(),
								                        ftMenuRootStringsMsg[i]));
								CG_EventHandling(CGAME_EVENT_NONE, qfalse);
							}
						}

						return qtrue;
					}
				}
				else
				{
					int             i;

					if (key >= 'a' || key <= 'z')
					{
						for (i = 0; ftMenuRootStrings[i]; i++)
						{
							if (key == tolower(*ftMenuRootStringsAlphachars[i]))
							{
								if (i < 5)
								{
									if (!CG_FireteamHasClass(i, qtrue))
									{
										return qfalse;
									}
								}

								if (doaction)
								{
									if (i < 5)
									{
										cgs.ftMenuPos = i;
									}
									else if (i == 5)
									{
										CG_QuickFireteamMessage_f();
									}
									else
									{
										trap_SendClientCommand(va
										                       ("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(),
										                        ftMenuRootStringsMsg[i]));
										CG_EventHandling(CGAME_EVENT_NONE, qfalse);
									}
								}

								return qtrue;
							}
						}
					}
				}
			}
			else
			{
				if (cgs.ftMenuPos < 0 || cgs.ftMenuPos > 4)
				{
					return qfalse;
				}

				if (cg_quickMessageAlt.integer)
				{
					if (key >= '0' && key <= '9')
					{
						int             i = ((key - '0') + 9) % 10;
						int             x;

						const char    **strings = ftMenuStrings[cgs.ftMenuPos];

						for (x = 0; strings[x]; x++)
						{
							if (x == i)
							{
								if (doaction)
								{
									trap_SendClientCommand(va
									                       ("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(),
									                        (ftMenuStringsMsg[cgs.ftMenuPos])[i]));
									CG_EventHandling(CGAME_EVENT_NONE, qfalse);
								}

								return qtrue;
							}
						}
					}
				}
				else
				{
					int             i;
					const char    **strings = ftMenuStrings[cgs.ftMenuPos];

					if (key >= 'a' || key <= 'z')
					{
						for (i = 0; strings[i]; i++)
						{
							if (key == tolower(*ftMenuStringsAlphachars[cgs.ftMenuPos][i]))
							{

								if (doaction)
								{

									trap_SendClientCommand(va
									                       ("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(),
									                        (ftMenuStringsMsg[cgs.ftMenuPos])[i]));
									CG_EventHandling(CGAME_EVENT_NONE, qfalse);
								}

								return qtrue;
							}
						}
					}
				}
			}

			break;

		case 1:
		{
			int             i = -1, x;

			if (cg_quickMessageAlt.integer)
			{
				if (key >= '0' && key <= '9')
				{
					i = ((key - '0') + 9) % 10;
				}
			}
			else
			{
				const char    **strings;

				if (!CG_IsOnFireteam(cg.clientNum))
				{
					strings = ftOffMenuListAlphachars;
				}
				else
				{
					if (!CG_IsFireTeamLeader(cg.clientNum))
					{
						strings = ftOnMenuListAlphachars;
					}
					else
					{
						strings = ftLeaderMenuListAlphachars;
					}
				}

				if (key >= 'a' || key <= 'z')
				{
					for (x = 0; strings[x]; x++)
					{
						if (key == tolower(*strings[x]))
						{
							i = x;
							break;
						}
					}
				}
			}

			if (i == -1)
			{
				break;
			}

			if (!CG_IsOnFireteam(cg.clientNum))
			{
				if (i >= 2)
				{
					break;
				}

				if (i == 0 && !CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team))
				{
					return qfalse;
				}

				if (doaction)
				{
					if (i == 1)
					{
						trap_SendConsoleCommand("fireteam create\n");
						CG_EventHandling(CGAME_EVENT_NONE, qfalse);
					}
					else
					{
						cgs.ftMenuMode = 2;
						cgs.ftMenuModeEx = 0;
						cgs.ftMenuPos = i;
					}
				}

				return qtrue;
			}
			else
			{
				if (!CG_IsFireTeamLeader(cg.clientNum))
				{
					if (i >= 2)
					{
						break;
					}

					if (i == 0 && !CG_CountPlayersNF())
					{
						break;
					}

					if (doaction)
					{
						if (i == 1)
						{
							trap_SendConsoleCommand("fireteam leave\n");
							CG_EventHandling(CGAME_EVENT_NONE, qfalse);
						}
						else
						{
							cgs.ftMenuMode = 3;
							cgs.ftMenuModeEx = 0;
							cgs.ftMenuPos = i;
						}
					}

					return qtrue;
				}
				else
				{
					if (i >= 5)
					{
						break;
					}

					if (i == 2 && !CG_CountPlayersNF())
					{
						break;
					}

					if ((i == 3 || i == 4) && !CG_CountPlayersSF())
					{
						break;
					}

					if (doaction)
					{
						if (i == 0)
						{
							trap_SendConsoleCommand("fireteam disband\n");
							CG_EventHandling(CGAME_EVENT_NONE, qfalse);
						}
						else if (i == 1)
						{
							trap_SendConsoleCommand("fireteam leave\n");
							CG_EventHandling(CGAME_EVENT_NONE, qfalse);
						}
						else
						{
							cgs.ftMenuMode = 4;
							cgs.ftMenuModeEx = 0;
							cgs.ftMenuPos = i;
						}
					}

					return qtrue;
				}
			}
		}
		break;

		case 2:
		{
			int             i;

			for (i = 0; i < MAX_FIRETEAMS; i++)
			{
				if (!cg.fireTeams[i].inuse)
				{
					continue;
				}

				if (cgs.clientinfo[cg.fireTeams[i].leader].team != cgs.clientinfo[cg.clientNum].team)
				{
					continue;
				}

				if (cg_quickMessageAlt.integer)
				{
					if (key >= '0' && key <= '9')
					{
						if (((key - '0') + 9) % 10 == cg.fireTeams[i].ident)
						{
							if (doaction)
							{
								trap_SendConsoleCommand(va("fireteam apply %i", i + 1));
								CG_EventHandling(CGAME_EVENT_NONE, qfalse);
							}

							return qtrue;
						}
					}
				}
				else
				{
					if (key >= 'a' || key <= 'z')
					{
						if (key - 'a' == cg.fireTeams[i].ident)
						{
							if (doaction)
							{
								trap_SendConsoleCommand(va("fireteam apply %i", i + 1));
								CG_EventHandling(CGAME_EVENT_NONE, qfalse);
							}

							return qtrue;
						}
					}
				}
			}
		}
		break;

		case 3:
		{
			int             i = -1, x;

			if (cg_quickMessageAlt.integer)
			{
				if (key >= '0' && key <= '9')
				{
					i = ((key - '0') + 9) % 10;
				}
			}
			else
			{
				if (key >= 'a' || key <= 'g')
				{
					i = key - 'a';
				}

				if (key == 'n')
				{
					i = 9;
				}

				if (key == 'p')
				{
					i = 0;
				}
			}

			if (i == -1)
			{
				break;
			}

			if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8)
			{
				if (i == 0)
				{
					cgs.ftMenuModeEx++;
				}
			}

			if (cgs.ftMenuModeEx)
			{
				if (i == 9)
				{
					cgs.ftMenuModeEx--;
				}
			}

			x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx);

			if (x != -1)
			{
				if (doaction)
				{
					trap_SendConsoleCommand(va("fireteam propose %i", x + 1));
					CG_EventHandling(CGAME_EVENT_NONE, qfalse);
				}

				return qtrue;
			}

			break;
		}
		break;

		case 4:
		{
			int             i = -1, x;

			if (cg_quickMessageAlt.integer)
			{
				if (key >= '0' && key <= '9')
				{
					i = ((key - '0') + 9) % 10;
				}
			}
			else
			{
				if (key >= 'a' || key <= 'g')
				{
					i = key - 'a';
				}

				if (key == 'n')
				{
					i = 9;
				}

				if (key == 'p')
				{
					i = 8;
				}
			}

			if (i == -1)
			{
				break;
			}

			switch (cgs.ftMenuPos)
			{
				case 2:
					if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8)
					{
						if (i == 9)
						{
							if (doaction)
							{
								cgs.ftMenuModeEx++;
							}

							return qtrue;
						}
					}

					if (cgs.ftMenuModeEx)
					{
						if (i == 8)
						{
							if (doaction)
							{
								cgs.ftMenuModeEx--;
							}

							return qtrue;
						}
					}

					x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx);

					if (x != -1)
					{
						if (doaction)
						{
							trap_SendConsoleCommand(va("fireteam invite %i", x + 1));
							CG_EventHandling(CGAME_EVENT_NONE, qfalse);
						}

						return qtrue;
					}

					break;

				case 3:
				case 4:
					if (CG_CountPlayersSF() > (cgs.ftMenuModeEx + 1) * 8)
					{
						if (i == 0)
						{
							cgs.ftMenuModeEx++;
						}
					}

					if (cgs.ftMenuModeEx)
					{
						if (i == 9)
						{
							cgs.ftMenuModeEx--;
						}
					}

					x = CG_PlayerSFFromPos(i, &cgs.ftMenuModeEx);

					if (x != -1)
					{
						if (doaction)
						{
							switch (cgs.ftMenuPos)
							{
								case 4:
									trap_SendConsoleCommand(va("fireteam warn %i", x + 1));
									CG_EventHandling(CGAME_EVENT_NONE, qfalse);
									break;

								case 3:
									trap_SendConsoleCommand(va("fireteam kick %i", x + 1));
									CG_EventHandling(CGAME_EVENT_NONE, qfalse);
									break;
							}
						}

						return qtrue;
					}

					break;
			}
		}
		break;
	}

	return qfalse;
}
Beispiel #22
0
void CG_LimboPanel_SendSetupMsg(qboolean forceteam) {
	weapon_t     weap1, weap2;
	const char   *str;
	team_t       team;
	weaponType_t *wt;

	if (forceteam) {
		team = CG_LimboPanel_GetTeam();
	} else {
		team = cgs.clientinfo[cg.clientNum].team;
	}

	if (team == TEAM_SPECTATOR) {
		if (forceteam) {
			if (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR) {
				trap_SendClientCommand("team s 0 0 0\n");
			}
			CG_EventHandling(CGAME_EVENT_NONE, qfalse);
		}
		return;
	}

	weap1 = CG_LimboPanel_GetSelectedWeaponForSlot(1);
	weap2 = CG_LimboPanel_GetSelectedWeaponForSlot(0);

	switch (team) {
	case TEAM_AXIS:
		str = "r";
		break;
	case TEAM_ALLIES:
		str = "b";
		break;
	default:
		str = NULL;     // rain - don't go spec
		break;
	}

	// rain - if this happens, we're dazed and confused, abort
	if (!str) {
		return;
	}

	trap_SendClientCommand(va("team %s %i %i %i\n", str, CG_LimboPanel_GetClass(), weap1, weap2));

	if (forceteam) {
		CG_EventHandling(CGAME_EVENT_NONE, qfalse);
	}

	// print center message
	switch (CG_LimboPanel_GetTeam()) {
	case TEAM_AXIS:
		str = "Axis";
		break;
	case TEAM_ALLIES:
		str = "Allied";
		break;
	default:     // rain - added default
		str = "unknown";
		break;
	}

	wt = WM_FindWeaponTypeForWeapon(weap1);
	CG_PriorityCenterPrint(va("You will spawn as an %s %s with a %s.", str, BG_ClassnameForNumber(CG_LimboPanel_GetClass()), wt ? wt->desc : "^1UNKNOWN WEAPON"), SCREEN_HEIGHT - 88, SMALLCHAR_WIDTH, -1);

	cgs.limboLoadoutSelected = qtrue;
	cgs.limboLoadoutModified = qtrue;
}
Beispiel #23
0
void CG_TeamSelectMenu_f(void) {
	CG_EventHandling( CGAME_EVENT_NONE, qfalse );
	trap_UI_Popup( UIMENU_WM_TEAMALT );
	trap_SendConsoleCommand( "vstr select_team;");
}
Beispiel #24
0
void CG_KeyEvent(int key, qboolean down)
{
	switch (cgs.eventHandling)
	{
	// Demos get their own keys
	case CGAME_EVENT_DEMO:
#ifdef FEATURE_EDV
		if (cg_predefineddemokeys.integer)
		{
			CG_DemoClick(key, down);
		}
		else
		{
			CG_RunBinding(key, down);
		}
		return;
#else
		CG_DemoClick(key, down);
		return;
#endif
	case CGAME_EVENT_CAMPAIGNBREIFING:
		CG_LoadPanel_KeyHandling(key, down);
		break;
	case CGAME_EVENT_FIRETEAMMSG:
		CG_Fireteams_KeyHandling(key, down);
		break;
	case CGAME_EVENT_GAMEVIEW:
		CG_LimboPanel_KeyHandling(key, down);
		break;
	case CGAME_EVENT_SPEAKEREDITOR:
		CG_SpeakerEditor_KeyHandling(key, down);
		break;
#ifdef FEATURE_MULTIVIEW
	case  CGAME_EVENT_MULTIVIEW:
#ifdef FEATURE_EDV
		if (cg_predefineddemokeys.integer)
		{
			CG_mv_KeyHandling(key, down);
		}
		else
		{
			CG_RunBinding(key, down);
		}
#else
		CG_mv_KeyHandling(key, down);
#endif
		break;
#endif
	default:
		if (cg.snap->ps.pm_type == PM_INTERMISSION)
		{
			CG_Debriefing_KeyEvent(key, down);
			return;
		}

		// default handling
		if (!down)
		{
			return;
		}

		if ((cg.predictedPlayerState.pm_type == PM_NORMAL ||
		     (cg.predictedPlayerState.pm_type == PM_SPECTATOR && cg.showScores == qfalse)))
		{

			CG_EventHandling(CGAME_EVENT_NONE, qfalse);
			return;
		}
		break;
	}
}