View Single Post
Old 09-13-2006, 04:46 AM   #128
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,161
Alternate fix for a dead body's color didn't match the player's color in team games. The fix offered by Enisform doesn't conform to the way team colors are normally forced on the player. In addition, I think that Ensiform's method might cause problems with dead body colors in siege.

g_client.c:

SetupGameGhoul2Model()
Change
Code:
if ( g_gametype.integer >= GT_TEAM && g_gametype.integer != GT_SIEGE && !g_trueJedi.integer )
{
	BG_ValidateSkinForTeam( truncModelName, skin, ent->client->sess.sessionTeam, NULL );
}
to
Code:
if ( g_gametype.integer >= GT_TEAM && g_gametype.integer != GT_SIEGE && !g_trueJedi.integer )
{
	//Also adjust customRGBA for team colors.
	float colorOverride[3];

	colorOverride[0] = colorOverride[1] = colorOverride[2] = 0.0f;

	BG_ValidateSkinForTeam( truncModelName, skin, ent->client->sess.sessionTeam, colorOverride);
	if (colorOverride[0] != 0.0f ||
		colorOverride[1] != 0.0f ||
		colorOverride[2] != 0.0f)
	{
		ent->client->ps.customRGBA[0] = colorOverride[0]*255.0f;
		ent->client->ps.customRGBA[1] = colorOverride[1]*255.0f;
		ent->client->ps.customRGBA[2] = colorOverride[2]*255.0f;
	}
}
ClientUserinfoChanged()
After
Code:
client->ps.customRGBA[3]=255;
Add
Code:
if ( g_gametype.integer >= GT_TEAM && g_gametype.integer != GT_SIEGE && !g_trueJedi.integer )
{
	char skin[MAX_QPATH];
	float colorOverride[3];

	colorOverride[0] = colorOverride[1] = colorOverride[2] = 0.0f;

	BG_ValidateSkinForTeam( model, skin, client->sess.sessionTeam, colorOverride);
	if (colorOverride[0] != 0.0f ||
		colorOverride[1] != 0.0f ||
		colorOverride[2] != 0.0f)
	{
		client->ps.customRGBA[0] = colorOverride[0]*255.0f;
		client->ps.customRGBA[1] = colorOverride[1]*255.0f;
		client->ps.customRGBA[2] = colorOverride[2]*255.0f;
	}
}
ClientSpawn()
After
Code:
client->ps.customRGBA[3]=255;
Add
Code:
//update our customRGBA for team colors. 
if ( g_gametype.integer >= GT_TEAM && g_gametype.integer != GT_SIEGE && !g_trueJedi.integer )
{
	char skin[MAX_QPATH];
	char model[MAX_QPATH];
	float colorOverride[3];

	colorOverride[0] = colorOverride[1] = colorOverride[2] = 0.0f;
	Q_strncpyz( model, Info_ValueForKey (userinfo, "model"), sizeof( model ) );

	BG_ValidateSkinForTeam( model, skin, savedSess.sessionTeam, colorOverride);
	if (colorOverride[0] != 0.0f ||
		colorOverride[1] != 0.0f ||
		colorOverride[2] != 0.0f)
	{
		client->ps.customRGBA[0] = colorOverride[0]*255.0f;
		client->ps.customRGBA[1] = colorOverride[1]*255.0f;
		client->ps.customRGBA[2] = colorOverride[2]*255.0f;
	}
}
Edit: Fixed typos in first and second code sections.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder

Last edited by razorace; 09-13-2006 at 03:51 PM.
razorace is offline   you may: quote & reply,