示例#1
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 );
	}
}
示例#2
0
static void CG_TeamVoiceChat_f( void ) {
	char chatCmd[64];

	if( trap_Argc() != 2 ) {
		return;
	}

	// NERVE - SMF - don't let spectators voice chat
	// NOTE - This cg.snap will be the person you are following, but its just for intermission test
	if ( cg.snap && cg.snap->ps.pm_type != PM_INTERMISSION &&
			cgs.etpub < ETPUB_VERSION(0,7,0) ) {
		if ( cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR || 
				cgs.clientinfo[cg.clientNum].team == TEAM_FREE ) {
			CG_Printf ( CG_TranslateString( "Can't team voice chat as a spectator.\n" ) );
			return;
		}
	}

	trap_Argv( 1, chatCmd, 64 );

	trap_SendConsoleCommand( va( "cmd vsay_team %s\n", chatCmd ) );
}
示例#3
0
/*
===================
CG_TransitionSnapshot

The transition point from snap to nextSnap has passed
===================
*/
static void CG_TransitionSnapshot( void ) {
	centity_t			*cent;
	snapshot_t			*oldFrame;
	int					i, id;

	if ( !cg.snap ) {
		CG_Error( "CG_TransitionSnapshot: NULL cg.snap" );
	}
	if ( !cg.nextSnap ) {
		CG_Error( "CG_TransitionSnapshot: NULL cg.nextSnap" );
	}

	// execute any server string commands before transitioning entities
	CG_ExecuteNewServerCommands( cg.nextSnap->serverCommandSequence );

	// if we had a map_restart, set everthing with initial
	
	if ( !(cg.snap) || !(cg.nextSnap) ) {
		return;
	}

	// rain - I hate doing things like this for enums.  Oh well.
	memset(&oldValid, 0, sizeof(oldValid));

	// clear the currentValid flag for all entities in the existing snapshot
	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {
		cent = &cg_entities[ cg.snap->entities[ i ].number ];
		cent->currentValid = qfalse;
		oldValid[cg.snap->entities[i].number] = qtrue;
	}

	// OSP -- check for MV updates from new snapshot info
#ifdef MV_SUPPORT
	if(cg.snap->ps.powerups[PW_MVCLIENTLIST] != cg.mvClientList) {
		CG_mvProcessClientList();
	}
#endif

	// move nextSnap to snap and do the transitions
	oldFrame = cg.snap;
	cg.snap = cg.nextSnap;

	// try to delag the crosshair pulse
	cg.snap->ps.aimSpreadScaleFloat = (float)cg.snap->ps.aimSpreadScale; 

	if( cg.snap->ps.clientNum == cg.clientNum ) {
		if( cg.xp < cg.snap->ps.stats[STAT_XP] ) {
			cg.xpChangeTime = cg.time;
		}

		// pheno: KMETAVZER - limbo panel XP overflow fix
		if( cgs.etpub > ETPUB_VERSION( 0, 8, 2 ) ) { 
			cg.xp = ( 32768 * cg.snap->ps.stats[STAT_XP_OVERFLOW] ) +
				cg.snap->ps.stats[STAT_XP];
		} else {
			cg.xp = cg.snap->ps.stats[STAT_XP];
		}
	}

	BG_PlayerStateToEntityState( &cg.snap->ps, &cg_entities[ cg.snap->ps.clientNum ].currentState, cg.time, qfalse );
	cg_entities[ cg.snap->ps.clientNum ].interpolate = qfalse;

	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {
		id = cg.snap->entities[ i ].number;
		CG_TransitionEntity( &cg_entities[ id ] );

		// rain - #374 - ent doesn't exist in this frame, reset it.
		// this is to fix the silent landmines bug, which is caused
		// by a stale miscTime in the cent
		if (cg_entities[id].currentValid == qfalse && oldValid[id] == qtrue) {
			CG_ResetEntity(&cg_entities[id]);
		}

		if(cg.mvTotalClients > 0 && CG_mvMergedClientLocate(id)) {
			CG_mvUpdateClientInfo(id);
		}
	}

	if(cg.mvTotalClients > 0) {
		CG_mvTransitionPlayerState(&cg.snap->ps);
	}

	cg.nextSnap = NULL;

	// check for playerstate transition events
	if ( oldFrame ) {
		playerState_t	*ops, *ps;

		ops = &oldFrame->ps;
		ps = &cg.snap->ps;
		// teleporting checks are irrespective of prediction
		if ( ( ps->eFlags ^ ops->eFlags ) & EF_TELEPORT_BIT ) {
			cg.thisFrameTeleport = qtrue;	// will be cleared by prediction code
		}

		// if we are not doing client side movement prediction for any
		// reason, then the client events and view changes will be issued now
		if ( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW)
			|| cg_nopredict.integer 
#ifdef ALLOW_GSYNC
			|| cg_synchronousClients.integer 
#endif // ALLOW_GSYNC
		) {
			CG_TransitionPlayerState( ps, ops );
		}
	}

}
void CG_DrawFireTeamOverlay( rectDef_t* rect ) {
	int x = rect->x;
	int y = rect->y + 1;	// +1, jitter it into place in 1024 :)
	int boxWidth = 204;
	int bestWidth = -1;
	char *locStr[MAX_FIRETEAM_MEMBERS];
	vec2_t loc;
	float h;
	clientInfo_t* ci = NULL;
	char buffer[64];
	fireteamData_t* f = NULL;
	int i;
	vec4_t clr1 =	{ .16f,		.2f,	.17f,	.8f };
	vec4_t clr2 =	{ 0.f,		0.f,		0.f,		.2f };
	vec4_t clr3 =	{ 0.25f,		0.f,		0.f,		153/255.f };
	vec4_t tclr =	{ 0.6f,		0.6f,		0.6f,		1.0f };
	vec4_t bgColor		= { 0.0f, 0.0f, 0.0f, 0.6f };		// window
	vec4_t borderColor	= { 0.5f, 0.5f, 0.5f, 0.5f };	// window
	centity_t*	cent;

	bgColor[3] = cg_fireteamAlpha.value;

	if(cg.hudEditor.showHudEditor) {
		//draw a fake fireteam box...
		CG_DrawFakeFireTeamOverlay(rect);
		return;
	} else 	if(!(f = CG_IsOnFireteam( cg.clientNum ))) {
		return;
	}

	h = 12 + 2 + 2;
	for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) {
		int		locwidth;
		vec3_t	origin;

		ci = CG_SortedFireTeamPlayerForPosition( i );
		if(!ci) {
			break;
		}

		h += FT_BAR_HEIGHT + FT_BAR_YSPACING;

		loc[0] = ci->location[0];
		loc[1] = ci->location[1];

		if(cg_locations.integer > 0) {
			qboolean locValid = qtrue;
			cent = &cg_entities[ci->clientNum];

			// Dens: use lerpOrigin for now
			origin[0] = cent->lerpOrigin[0];
			origin[1] = cent->lerpOrigin[1];
			origin[2] = cent->lerpOrigin[2];
	
			locStr[i] = va( "^3%s", CG_GetLocationMsg(origin));

			if (!Q_stricmp( locStr[i], "^3Unknown")){
				locStr[i] = va( "^3(%s)", BG_GetLocationString( loc ));
				locValid = qfalse;
			}

			if(cg_locations.integer > 1 && locValid)
				Q_strcat( locStr[i], 64, va(" ^3(%s)", BG_GetLocationString( loc )) );

		} else {
			locStr[i] = va( "^3(%s)", BG_GetLocationString( loc ));
		}

		if( !locStr[i][1] || !*locStr[i] )
			locStr[i] = " ";
	
		locwidth = CG_Text_Width_Ext( locStr[i], 0.2f, 0, &cgs.media.font3 );
	
		if(locwidth > bestWidth)
			bestWidth = locwidth;
	}

	boxWidth += bestWidth;

	CG_DrawRect( x, y, boxWidth, h, 1, borderColor);
	CG_FillRect( x + 1, y + 1, boxWidth - 2, h - 2, bgColor);

	x += 2;
	y += 2;

	CG_FillRect( x, y, boxWidth - 4, 12, clr1 );

	Com_sprintf( buffer, 64, "Fireteam: %s", bg_fireteamNames[f->ident] );
	//sprintf( buffer, "Fireteam: %s", bg_fireteamNames[f->ident] );
	Q_strupr( buffer );
	CG_Text_Paint_Ext( x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.font1 );

	x += 2;
	//y += 2;

	for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) {
		y += FT_BAR_HEIGHT + FT_BAR_YSPACING;
		x = rect->x + 2;

		ci = CG_SortedFireTeamPlayerForPosition( i );
		if(!ci) {
			break;;
		}
		
		if( ci->selected ) {
			CG_FillRect( x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr3 );
		} else {
			CG_FillRect( x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr2 );
		}

		x += 4;
				
		//draw class
		if(cg_drawClassIcons.integer & CLASSICON_FIRETEAM){
			trap_R_SetColor( colorWhite );
			CG_DrawPic(x-2, y+2, FT_BAR_HEIGHT, FT_BAR_HEIGHT,
				cgs.media.skillPics[BG_ClassSkillForClass( ci->cls )]);
			trap_R_SetColor( NULL );
		}else{
			CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorWhite, BG_ClassLetterForNumber( ci->cls ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );	
		}
		x += 10;
		
		// quad: draw latched class
		// pheno: not with an old server, that doesn't send the latched class
		if( ci->cls != ci->latchClass && cgs.etpub > ETPUB_VERSION( 0, 8, 1 ) ) {
			//draw separator
			CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, ">", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
			x += 10;
			
			//draw class
			if(cg_drawClassIcons.integer & CLASSICON_FIRETEAM) {
				trap_R_SetColor( colorYellow );
				CG_DrawPic(x - 2, y + 2, FT_BAR_HEIGHT, FT_BAR_HEIGHT,
					cgs.media.skillPics[BG_ClassSkillForClass(ci->latchClass)]);
				trap_R_SetColor(NULL);
			} else {
				CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, BG_ClassLetterForNumber( ci->latchClass ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
			}
			x += 10;
		}
		else
			x += 20;
		
		CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->team == TEAM_AXIS ? miniRankNames_Axis[ci->rank] : miniRankNames_Allies[ci->rank], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );	
		x += 22;
		
		CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
		x += 90;

/*		CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.movementAutonomyIcons[0]);
		x += FT_BAR_HEIGHT;

		CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.weaponAutonomyIcons[0]);
		x += FT_BAR_HEIGHT;
		x += 4;*/

/*		if( isLeader ) {
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", i+4), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
		}*/
		x += 20;
		
		if( ci->health > 80 ) {
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT,  .2f, .2f, tclr, va("%i", ci->health < 0 ? 0 : ci->health ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
		} else if( ci->health > 0 ) {
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT,  .2f, .2f, colorYellow, va("%i", ci->health < 0 ? 0 : ci->health ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
		} else {
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT,  .2f, .2f, colorRed, va("0%s", ci->health < 0 ? "" : "*" ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
		}
		x += 30;

		CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT,  .2f, .2f, tclr, locStr[i], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 );
	}
}