Exemple #1
0
void CG_LimboPanel_WeaponPanel_DrawWeapon(rectDef_t *rect, weapon_t weap, qboolean highlight, const char *ofTxt, qboolean disabled) {
	weaponType_t *wt    = WM_FindWeaponTypeForWeapon(weap);
	qhandle_t    shader = cgs.media.limboWeaponCard;
	int          width  = CG_Text_Width_Ext(ofTxt, 0.2f, 0, &cgs.media.limboFont2);
	float        x      = rect->x + rect->w - width - 4;
	vec4_t       clr;

	if (!wt) {
		return;
	}

	CG_DrawPic(rect->x, rect->y, rect->w, rect->h, shader);
	if (wt->desc) {
		if (highlight && BG_CursorInRect(rect)) {
			Vector4Copy(weaponPanelNameFont.colour, clr);
			clr[3] *= 1.5;
			CG_Text_Paint_Ext(rect->x + 4, rect->y + 12, weaponPanelNameFont.scalex, weaponPanelNameFont.scaley, clr, wt->desc, 0, 0, weaponPanelNameFont.style, weaponPanelNameFont.font);
		} else {
			CG_Text_Paint_Ext(rect->x + 4, rect->y + 12, weaponPanelNameFont.scalex, weaponPanelNameFont.scaley, weaponPanelNameFont.colour, wt->desc, 0, 0, weaponPanelNameFont.style, weaponPanelNameFont.font);
		}
	}

	{
		float x2, y2, w, h, s0, s1, t0, t1;

		trap_R_SetColor(NULL);

		x2 = rect->x;
		y2 = rect->y + (rect->h * 0.25f);

		CG_LimboPanel_GetWeaponCardIconData(weap, &shader, &w, &h, &s0, &t0, &s1, &t1);

		w *= rect->w;
		h *= rect->h * 0.75f;

		CG_DrawPicST(x2, y2, w, h, s0, t0, s1, t1, shader);

		if (disabled) {
			vec4_t clr = { 1.f, 1.f, 1.f, 0.6f };

			trap_R_SetColor(clr);
			CG_DrawPic(x2, y2 + 4 + (h - 16) * 0.5f, w, 16, cgs.media.limboWeaponCardOOS);
			trap_R_SetColor(NULL);
		}
	}
	CG_Text_Paint_Ext(x, rect->y + rect->h - 2, 0.2f, 0.2f, colorBlack, ofTxt, 0, 0, 0, &cgs.media.limboFont2);
}
Exemple #2
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;
}
Exemple #3
0
/**
 * @brief Sends an class setup message. Enables etpro like classscripts
 */
void CG_Class_f(void)
{
	char             cls[64];
	const char       *classtype, *teamstring;
	int              weapon1, weapon2, playerclass;
	bg_playerclass_t *classinfo;
	team_t           team;
	weaponType_t     *wt;

	if (cg.demoPlayback)
	{
		return;
	}

	team = cgs.clientinfo[cg.clientNum].team;

	if (team == TEAM_SPECTATOR)
	{
		return;
	}

	if (trap_Argc() < 2)
	{
		CG_Printf("Invalid command format.\n");
		return;
	}

	switch (team)
	{
	case TEAM_AXIS:
		classtype  = "r";
		teamstring = "Axis";
		break;
	case TEAM_ALLIES:
		classtype  = "b";
		teamstring = "Allies";
		break;
	default:
		CG_Printf("Invalid team.\n");
		return;
	}

	trap_Argv(1, cls, 64);

	if (!Q_stricmp(cls, "s"))
	{
		playerclass = PC_SOLDIER;
	}
	else if (!Q_stricmp(cls, "m"))
	{
		playerclass = PC_MEDIC;
	}
	else if (!Q_stricmp(cls, "e"))
	{
		playerclass = PC_ENGINEER;
	}
	else if (!Q_stricmp(cls, "f"))
	{
		playerclass = PC_FIELDOPS;
	}
	else if (!Q_stricmp(cls, "c"))
	{
		playerclass = PC_COVERTOPS;
	}
	else
	{
		CG_Printf("Invalid class format.\n");
		return;
	}

	classinfo = BG_GetPlayerClassInfo(team, playerclass);

	if (trap_Argc() > 2)
	{
		trap_Argv(2, cls, 64);
		weapon1 = atoi(cls);
		if (!classinfo->classWeapons[weapon1 - 1])
		{
			CG_Printf("Invalid command format for weapon.\n");
			return;
		}
	}
	else
	{
		weapon1 = 1;
	}

	if (cgs.clientinfo[cg.clientNum].skill[SK_HEAVY_WEAPONS] >= 4 && playerclass == PC_SOLDIER)
	{
		weapon2 = (team == TEAM_AXIS) ? WP_MP40 : WP_THOMPSON;
	}
	else if (cgs.clientinfo[cg.clientNum].skill[SK_LIGHT_WEAPONS] >= 4)
	{
		if (playerclass == PC_COVERTOPS)
		{
			weapon2 = (team == TEAM_AXIS) ? WP_AKIMBO_SILENCEDLUGER : WP_AKIMBO_SILENCEDCOLT;
		}
		else
		{
			weapon2 = (team == TEAM_AXIS) ? WP_AKIMBO_LUGER : WP_AKIMBO_COLT;
		}
	}
	else
	{
		if (playerclass == PC_COVERTOPS)
		{
			weapon2 = (team == TEAM_AXIS) ? WP_SILENCER : WP_SILENCED_COLT;
		}
		else
		{
			weapon2 = (team == TEAM_AXIS) ? WP_LUGER : WP_COLT;
		}
	}

	// Print out the selected class and weapon info
	wt = WM_FindWeaponTypeForWeapon(classinfo->classWeapons[weapon1 - 1]);
	CG_PriorityCenterPrint(va(CG_TranslateString("You will spawn as a %s %s with a %s."), teamstring, BG_ClassnameForNumber(playerclass), wt ? wt->desc : "^1UNKNOWN WEAPON"), SCREEN_HEIGHT - 88, SMALLCHAR_WIDTH, -1);
	// Send the switch command to the server
	trap_SendClientCommand(va("team %s %i %i %i\n", classtype, playerclass, classinfo->classWeapons[weapon1 - 1], weapon2));
}