Change sm_beacon to use game-specific team colors (#1187)
Added game color config & specific settings for L4D/L4D2 Created the following keys: "Team1Color" "75,255,75,255" "Team2Color" "255,75,75,255" "Team3Color" "75,75,255,255" "Team4Color" "255,128,0,255" "TeamUnknownColor" "255,255,255,255" Added a specific setting for L4D/L4D2 game: "Team2Color" "75,75,255,255" "Team3Color" "255,75,75,255"
This commit is contained in:
parent
8a5d0a58e4
commit
cd37354634
@ -15,6 +15,13 @@
|
|||||||
"SoundFinal" "weapons/cguard/charging.wav"
|
"SoundFinal" "weapons/cguard/charging.wav"
|
||||||
"SoundBoom" "weapons/explode3.wav"
|
"SoundBoom" "weapons/explode3.wav"
|
||||||
"SoundFreeze" "physics/glass/glass_impact_bullet4.wav"
|
"SoundFreeze" "physics/glass/glass_impact_bullet4.wav"
|
||||||
|
|
||||||
|
"ExternalBeaconColor" "128,128,128,255"
|
||||||
|
"Team1BeaconColor" "75,255,75,255"
|
||||||
|
"Team2BeaconColor" "255,75,75,255"
|
||||||
|
"Team3BeaconColor" "75,75,255,255"
|
||||||
|
"Team4BeaconColor" "255,128,0,255"
|
||||||
|
"TeamUnknownBeaconColor" "255,255,255,255"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +79,9 @@
|
|||||||
"SpriteExplosion" "sprites/floorfire4_.vmt"
|
"SpriteExplosion" "sprites/floorfire4_.vmt"
|
||||||
"SpriteGlow" "sprites/blueflare1.vmt"
|
"SpriteGlow" "sprites/blueflare1.vmt"
|
||||||
"SpriteHalo" "sprites/glow01.vmt"
|
"SpriteHalo" "sprites/glow01.vmt"
|
||||||
|
|
||||||
|
"Team2BeaconColor" "75,75,255,255"
|
||||||
|
"Team3BeaconColor" "255,75,75,255"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -67,13 +67,18 @@ int g_GlowSprite = -1;
|
|||||||
int g_ExplosionSprite = -1;
|
int g_ExplosionSprite = -1;
|
||||||
|
|
||||||
// Basic color arrays for temp entities
|
// Basic color arrays for temp entities
|
||||||
int redColor[4] = {255, 75, 75, 255};
|
|
||||||
int orangeColor[4] = {255, 128, 0, 255};
|
int orangeColor[4] = {255, 128, 0, 255};
|
||||||
int greenColor[4] = {75, 255, 75, 255};
|
|
||||||
int blueColor[4] = {75, 75, 255, 255};
|
int blueColor[4] = {75, 75, 255, 255};
|
||||||
int whiteColor[4] = {255, 255, 255, 255};
|
int whiteColor[4] = {255, 255, 255, 255};
|
||||||
int greyColor[4] = {128, 128, 128, 255};
|
int greyColor[4] = {128, 128, 128, 255};
|
||||||
|
|
||||||
|
int g_ExternalBeaconColor[4];
|
||||||
|
int g_Team1BeaconColor[4];
|
||||||
|
int g_Team2BeaconColor[4];
|
||||||
|
int g_Team3BeaconColor[4];
|
||||||
|
int g_Team4BeaconColor[4];
|
||||||
|
int g_TeamUnknownBeaconColor[4];
|
||||||
|
|
||||||
// UserMessageId for Fade.
|
// UserMessageId for Fade.
|
||||||
UserMsg g_FadeUserMsgId;
|
UserMsg g_FadeUserMsgId;
|
||||||
|
|
||||||
@ -239,6 +244,36 @@ public void OnMapStart()
|
|||||||
g_HaloSprite = PrecacheModel(buffer);
|
g_HaloSprite = PrecacheModel(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gameConfig.GetKeyValue("ExternalBeaconColor", buffer, sizeof(buffer)) && buffer[0])
|
||||||
|
{
|
||||||
|
g_ExternalBeaconColor = ParseColor(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameConfig.GetKeyValue("Team1BeaconColor", buffer, sizeof(buffer)) && buffer[0])
|
||||||
|
{
|
||||||
|
g_Team1BeaconColor = ParseColor(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameConfig.GetKeyValue("Team2BeaconColor", buffer, sizeof(buffer)) && buffer[0])
|
||||||
|
{
|
||||||
|
g_Team2BeaconColor = ParseColor(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameConfig.GetKeyValue("Team3BeaconColor", buffer, sizeof(buffer)) && buffer[0])
|
||||||
|
{
|
||||||
|
g_Team3BeaconColor = ParseColor(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameConfig.GetKeyValue("Team4BeaconColor", buffer, sizeof(buffer)) && buffer[0])
|
||||||
|
{
|
||||||
|
g_Team4BeaconColor = ParseColor(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameConfig.GetKeyValue("TeamUnknownBeaconColor", buffer, sizeof(buffer)) && buffer[0])
|
||||||
|
{
|
||||||
|
g_TeamUnknownBeaconColor = ParseColor(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
delete gameConfig;
|
delete gameConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,3 +332,17 @@ void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int
|
|||||||
Format(buffer, sizeof(buffer), "%T", phrase, client);
|
Format(buffer, sizeof(buffer), "%T", phrase, client);
|
||||||
menu.AddItem(opt, buffer);
|
menu.AddItem(opt, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int[] ParseColor(const char[] buffer)
|
||||||
|
{
|
||||||
|
char sColor[16][4];
|
||||||
|
ExplodeString(buffer, ",", sColor, sizeof(sColor), sizeof(sColor[]));
|
||||||
|
|
||||||
|
int iColor[4];
|
||||||
|
iColor[0] = StringToInt(sColor[0]);
|
||||||
|
iColor[1] = StringToInt(sColor[1]);
|
||||||
|
iColor[2] = StringToInt(sColor[2]);
|
||||||
|
iColor[3] = StringToInt(sColor[3]);
|
||||||
|
|
||||||
|
return iColor;
|
||||||
|
}
|
||||||
|
@ -85,8 +85,6 @@ public Action Timer_Beacon(Handle timer, any value)
|
|||||||
KillBeacon(client);
|
KillBeacon(client);
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
int team = GetClientTeam(client);
|
|
||||||
|
|
||||||
float vec[3];
|
float vec[3];
|
||||||
GetClientAbsOrigin(client, vec);
|
GetClientAbsOrigin(client, vec);
|
||||||
@ -94,22 +92,21 @@ public Action Timer_Beacon(Handle timer, any value)
|
|||||||
|
|
||||||
if (g_BeamSprite > -1 && g_HaloSprite > -1)
|
if (g_BeamSprite > -1 && g_HaloSprite > -1)
|
||||||
{
|
{
|
||||||
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
|
int teamBeaconColor[4];
|
||||||
|
|
||||||
|
switch (GetClientTeam(client))
|
||||||
|
{
|
||||||
|
case 1: teamBeaconColor = g_Team1BeaconColor;
|
||||||
|
case 2: teamBeaconColor = g_Team2BeaconColor;
|
||||||
|
case 3: teamBeaconColor = g_Team3BeaconColor;
|
||||||
|
case 4: teamBeaconColor = g_Team4BeaconColor;
|
||||||
|
default: teamBeaconColor = g_TeamUnknownBeaconColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, g_ExternalBeaconColor, 10, 0);
|
||||||
TE_SendToAll();
|
TE_SendToAll();
|
||||||
|
|
||||||
if (team == 2)
|
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, teamBeaconColor, 10, 0);
|
||||||
{
|
|
||||||
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, redColor, 10, 0);
|
|
||||||
}
|
|
||||||
else if (team == 3)
|
|
||||||
{
|
|
||||||
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, blueColor, 10, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TE_SetupBeamRingPoint(vec, 10.0, g_Cvar_BeaconRadius.FloatValue, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, greenColor, 10, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
TE_SendToAll();
|
TE_SendToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user