minimap alpha

This commit is contained in:
Gerhard Klassen 2020-03-28 20:16:47 +01:00
parent 7989dadc13
commit 8674080504
25 changed files with 422 additions and 77 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1,19 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio Version 16
VisualStudioVersion = 14.0.24720.0 VisualStudioVersion = 16.0.29911.84
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cl_dll.dll", "cl_dll\cl_dll.vcxproj", "{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cl_dll.dll", "cl_dll\cl_dll.vcxproj", "{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}"
ProjectSection(ProjectDependencies) = postProject
{5AADD469-7488-4B34-A9FD-01CFAC5972FD} = {5AADD469-7488-4B34-A9FD-01CFAC5972FD}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ns.dll", "dlls\hl.vcxproj", "{BC87A180-F17B-83FC-5D7D-470FAD003ABC}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ns.dll", "dlls\hl.vcxproj", "{BC87A180-F17B-83FC-5D7D-470FAD003ABC}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "particles", "particles\particles.vcxproj", "{5AADD469-7488-4B34-A9FD-01CFAC5972FD}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Developer - debug|Win32 = Developer - debug|Win32 Developer - debug|Win32 = Developer - debug|Win32
Developer - release|Win32 = Developer - release|Win32 Developer - release|Win32 = Developer - release|Win32
Playtest - balance disabled|Win32 = Playtest - balance disabled|Win32 Playtest - balance disabled|Win32 = Playtest - balance disabled|Win32
Playtest|Win32 = Playtest|Win32 Playtest|Win32 = Playtest|Win32
Release|Win32 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Debug|Win32.ActiveCfg = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Debug|Win32.Build.0 = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Developer - debug|Win32.ActiveCfg = Playtest|Win32 {665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Developer - debug|Win32.ActiveCfg = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Developer - debug|Win32.Build.0 = Playtest|Win32 {665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Developer - debug|Win32.Build.0 = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Developer - release|Win32.ActiveCfg = Playtest|Win32 {665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Developer - release|Win32.ActiveCfg = Playtest|Win32
@ -22,14 +31,35 @@ Global
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Playtest - balance disabled|Win32.Build.0 = Playtest|Win32 {665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Playtest - balance disabled|Win32.Build.0 = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Playtest|Win32.ActiveCfg = Playtest|Win32 {665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Playtest|Win32.ActiveCfg = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Playtest|Win32.Build.0 = Playtest|Win32 {665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Playtest|Win32.Build.0 = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Release|Win32.ActiveCfg = Playtest|Win32
{665C1DAF-9248-E06F-4E5C-A664BAFDE9D8}.Release|Win32.Build.0 = Playtest|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Debug|Win32.ActiveCfg = Developer - release|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Debug|Win32.Build.0 = Developer - release|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Developer - debug|Win32.ActiveCfg = Developer - debug|Win32 {BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Developer - debug|Win32.ActiveCfg = Developer - debug|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Developer - release|Win32.ActiveCfg = Developer - release|Win32 {BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Developer - release|Win32.ActiveCfg = Developer - release|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest - balance disabled|Win32.ActiveCfg = Playtest - balance disabled|Win32 {BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest - balance disabled|Win32.ActiveCfg = Playtest - balance disabled|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest - balance disabled|Win32.Build.0 = Playtest - balance disabled|Win32 {BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest - balance disabled|Win32.Build.0 = Playtest - balance disabled|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest|Win32.ActiveCfg = Playtest|Win32 {BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest|Win32.ActiveCfg = Playtest|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest|Win32.Build.0 = Playtest|Win32 {BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Playtest|Win32.Build.0 = Playtest|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Release|Win32.ActiveCfg = Playtest|Win32
{BC87A180-F17B-83FC-5D7D-470FAD003ABC}.Release|Win32.Build.0 = Playtest|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Debug|Win32.ActiveCfg = Debug|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Debug|Win32.Build.0 = Debug|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Developer - debug|Win32.ActiveCfg = Debug|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Developer - debug|Win32.Build.0 = Debug|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Developer - release|Win32.ActiveCfg = Debug|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Developer - release|Win32.Build.0 = Debug|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Playtest - balance disabled|Win32.ActiveCfg = Release|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Playtest - balance disabled|Win32.Build.0 = Release|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Playtest|Win32.ActiveCfg = Release|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Playtest|Win32.Build.0 = Release|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Release|Win32.ActiveCfg = Release|Win32
{5AADD469-7488-4B34-A9FD-01CFAC5972FD}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D404BD1D-513A-4DF3-BAB1-7BB1ED64C225}
EndGlobalSection
EndGlobal EndGlobal

Binary file not shown.

Binary file not shown.

View file

@ -241,6 +241,7 @@ struct extra_player_info_t
short playerclass; short playerclass;
short extra; short extra;
short auth; short auth;
short player_index;
short teamnumber; short teamnumber;
char teamname[MAX_TEAM_NAME]; char teamname[MAX_TEAM_NAME];
char customicon[CUSTOM_ICON_LENGTH + 3]; //last 3 characters is the color. char customicon[CUSTOM_ICON_LENGTH + 3]; //last 3 characters is the color.

Binary file not shown.

Binary file not shown.

View file

@ -33,8 +33,8 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">.\release</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">F:\Steam\steamapps\common\Half-Life\ns\cl_dlls</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">.</IntDir>
<ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">$(TargetPath)%3b*.obj%3b*.ilk%3b*.pdb%3b*.tlb%3b*.tli%3b*.tlh%3b*.tmp%3b*.rsp%3b*.bat</ExtensionsToDeleteOnClean> <ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">$(TargetPath)%3b*.obj%3b*.ilk%3b*.pdb%3b*.tlb%3b*.tli%3b*.tlh%3b*.tmp%3b*.rsp%3b*.bat</ExtensionsToDeleteOnClean>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">false</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">client</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">client</TargetName>
@ -72,7 +72,7 @@
<ShowIncludes>false</ShowIncludes> <ShowIncludes>false</ShowIncludes>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>particles.lib;vgui.lib;zlib.lib;libpng.lib;wsock32.lib;sdl2.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>\..\..\Release\particles.lib;vgui.lib;zlib.lib;libpng.lib;wsock32.lib;sdl2.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>$(SolutionDir)\particles\Release;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\vgui\lib\win32_vc6;$(SolutionDir)\lib\public;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)\particles\Release;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\vgui\lib\win32_vc6;$(SolutionDir)\lib\public;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>
@ -89,7 +89,7 @@
<TreatLinkerWarningAsErrors> <TreatLinkerWarningAsErrors>
</TreatLinkerWarningAsErrors> </TreatLinkerWarningAsErrors>
<AdditionalOptions>/NODEFAULTLIB:LIBCMT %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/NODEFAULTLIB:LIBCMT %(AdditionalOptions)</AdditionalOptions>
<OutputFile>$(SolutionDir)..\cl_dlls\client.dll</OutputFile> <OutputFile>F:\Steam\steamapps\common\Half-Life\ns\cl_dlls\client.dll</OutputFile>
</Link> </Link>
<Midl> <Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">
<LocalDebuggerCommand>..\..\..\..\..\..\..\Program Files %28x86%29\Steam\SteamApps\common\Half-Life\hl.exe</LocalDebuggerCommand> <LocalDebuggerCommand>F:\Steam\steamapps\common\Half-Life\hl.exe</LocalDebuggerCommand>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments> -allowdebug -dev -steam -game ns</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments> -allowdebug -dev -steam -game ns</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>..\..\..\..\..\..\Steam\steamapps\common\Half-Life\ns</LocalDebuggerWorkingDirectory>
<LocalDebuggerAttach>false</LocalDebuggerAttach> <LocalDebuggerAttach>false</LocalDebuggerAttach>
<LocalDebuggerDebuggerType>Auto</LocalDebuggerDebuggerType> <LocalDebuggerDebuggerType>Auto</LocalDebuggerDebuggerType>
</PropertyGroup> </PropertyGroup>

View file

@ -81,6 +81,12 @@
#include "mod/AvHServerVariables.h" #include "mod/AvHServerVariables.h"
#include "util/STLUtil.h" #include "util/STLUtil.h"
#include "ui/ScoreboardIcon.h" #include "ui/ScoreboardIcon.h"
#include <string>
#include <array>
#include<algorithm>
#include "AvHServerVariables.h"
using namespace std;
/* @2014 /* @2014
#include "common/itrackeruser.h" #include "common/itrackeruser.h"
extern ITrackerUser *g_pTrackerUser; extern ITrackerUser *g_pTrackerUser;
@ -101,6 +107,17 @@ int EV_TFC_IsAllyTeam( int iTeam1, int iTeam2 );
void LoadData(void* inBuffer, const unsigned char* inData, int inSizeToCopy, int& inSizeVariable); void LoadData(void* inBuffer, const unsigned char* inData, int inSizeToCopy, int& inSizeVariable);
void SaveData(unsigned char* inBuffer, const void* inData, int inSizeToCopy, int& inSizeVariable); void SaveData(unsigned char* inBuffer, const void* inData, int inSizeToCopy, int& inSizeVariable);
void Output(const char* szFormat, ...)
{
char szBuff[1024];
va_list arg;
va_start(arg, szFormat);
_vsnprintf(szBuff, sizeof(szBuff), szFormat, arg);
va_end(arg);
OutputDebugString(szBuff);
}
int ScorePanel_InitializeDemoPlayback(int inSize, unsigned char* inBuffer) int ScorePanel_InitializeDemoPlayback(int inSize, unsigned char* inBuffer)
{ {
int theBytesRead = 0; int theBytesRead = 0;
@ -187,16 +204,16 @@ vgui::Color BuildColor( int R, int G, int B, float gamma )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Create the ScoreBoard panel // Purpose: Create the ScoreBoard panel
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall) ScorePanel::ScorePanel(int x, int y, int wide, int tall) : Panel(x, y, wide, tall)
{ {
CSchemeManager *pSchemes = gViewPort->GetSchemeManager(); CSchemeManager* pSchemes = gViewPort->GetSchemeManager();
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text"); SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text"); SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text"); SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text");
Font *tfont = pSchemes->getFont(hTitleScheme); Font* tfont = pSchemes->getFont(hTitleScheme);
Font *smallfont = pSchemes->getFont(hSmallScheme); Font* smallfont = pSchemes->getFont(hSmallScheme);
Font *tinyfont = pSchemes->getFont(hTinyScheme); Font* tinyfont = pSchemes->getFont(hTinyScheme);
setBgColor(0, 0, 0, 96); setBgColor(0, 0, 0, 96);
m_pCurrentHighlightLabel = NULL; m_pCurrentHighlightLabel = NULL;
m_iHighlightRow = -1; m_iHighlightRow = -1;
@ -209,7 +226,7 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_pContribIcon = NULL; m_pContribIcon = NULL;
m_pCheatingDeathIcon = NULL; m_pCheatingDeathIcon = NULL;
m_pVeteranIcon = NULL; m_pVeteranIcon = NULL;
m_pHMG = NULL; m_pHMG = NULL;
m_pMine = NULL; m_pMine = NULL;
m_pWeld = NULL; m_pWeld = NULL;
@ -226,7 +243,6 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga"); m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga");
m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga"); m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga");
m_pHMG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardhmg.tga"); m_pHMG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardhmg.tga");
m_pMine = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardmine.tga"); m_pMine = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardmine.tga");
@ -236,6 +252,18 @@ ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
m_iIconFrame = 0; m_iIconFrame = 0;
m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate(); m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate();
// Player Colors indicators
m_pCYellow = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_yellow.tga");
for (int i = 0; i < MAX_PLAYERS; i++) {
m_pColorIcons[i] = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga");
}
// Initialize the top title. // Initialize the top title.
m_TitleLabel.setFont(tfont); m_TitleLabel.setFont(tfont);
@ -811,6 +839,7 @@ void ScorePanel::FillGrid()
hud_player_info_t* pl_info = &g_PlayerInfoList[theSortedRow]; hud_player_info_t* pl_info = &g_PlayerInfoList[theSortedRow];
extra_player_info_t* theExtraPlayerInfo = &g_PlayerExtraInfo[theSortedRow]; extra_player_info_t* theExtraPlayerInfo = &g_PlayerExtraInfo[theSortedRow];
int thePlayerClass = theExtraPlayerInfo->playerclass; int thePlayerClass = theExtraPlayerInfo->playerclass;
int thePlayerId = theExtraPlayerInfo->player_index;
short theTeamNumber = theExtraPlayerInfo->teamnumber; short theTeamNumber = theExtraPlayerInfo->teamnumber;
string theCustomIcon = (string)theExtraPlayerInfo->customicon; string theCustomIcon = (string)theExtraPlayerInfo->customicon;
// : 0001073 // : 0001073
@ -1070,10 +1099,83 @@ void ScorePanel::FillGrid()
} }
} }
*/ */
// set Player Color
//Output((to_string(thePlayerId)+ string("\n")).c_str());
//ConsolePrint((to_string(thePlayerId)+ string("\n")).c_str());
switch (theTeamNumber) {
case 1:
if (std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId) == std::end(players_marine_team)){
players_marine_team.push_back(thePlayerId);
players_marine_team.sort();
}
else if (std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId) != std::end(players_alien_team)) {
players_alien_team.erase(std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId));
players_alien_team.sort();
}
break;
case 2:
if (std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId) == std::end(players_alien_team)) {
players_alien_team.push_back(thePlayerId);
players_alien_team.sort();
}
else if (std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId) != std::end(players_marine_team)) {
players_marine_team.erase(std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId));
players_marine_team.sort();
}
break;
default:
if (std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId) != std::end(players_alien_team)) {
players_alien_team.erase(std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId));
players_alien_team.sort();
}
else if (std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId) != std::end(players_marine_team)) {
players_marine_team.erase(std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId));
players_marine_team.sort();
}
break;
}
if(pl_info) if(pl_info)
{ {
sprintf(sz, "%s ", pl_info->name);
if (gHUD.GetServerVariableFloat(kvTournamentMode)) {
sprintf(sz, " %s ", pl_info->name);
pLabel->setImage(m_pColorIcons[thePlayerId]);
pLabel->setFgColorAsImageColor(false);
switch (theTeamNumber) {
case 1:
m_pColorIndex = std::distance(std::begin(players_marine_team), std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId));
m_pColorIndex = m_pColorIndex % player_colors.size();
m_pColorIcons[thePlayerId]->setColor(BuildColor(player_colors[m_pColorIndex][0],
player_colors[m_pColorIndex][1],
player_colors[m_pColorIndex][2], gHUD.GetGammaSlope()));
break;
case 2:
m_pColorIndex = std::distance(std::begin(players_alien_team), std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId));
m_pColorIndex = m_pColorIndex % player_colors.size();
m_pColorIcons[thePlayerId]->setColor(BuildColor(player_colors[m_pColorIndex][0],
player_colors[m_pColorIndex][1],
player_colors[m_pColorIndex][2], gHUD.GetGammaSlope()));
break;
default:
m_pColorIcons[thePlayerId]->setColor(BuildColor(255, 255, 255, gHUD.GetGammaSlope()));
break;
}
}
else {
sprintf(sz, "%s ", pl_info->name);
}
} }
break; break;
case COLUMN_VOICE: case COLUMN_VOICE:
sz[0] = 0; sz[0] = 0;
@ -1198,7 +1300,8 @@ void ScorePanel::FillGrid()
pLabel->setFgColorAsImageColor(false); pLabel->setFgColorAsImageColor(false);
m_pServerOpIcon->setColor(BuildColor(0, 255, 0, gHUD.GetGammaSlope())); m_pServerOpIcon->setColor(BuildColor(0, 255, 0, gHUD.GetGammaSlope()));
} }
// Allow custom icons to override other general icons // Allow custom icons to override other general icons
if(thePlayerAuthentication & PLAYERAUTH_CUSTOM) if(thePlayerAuthentication & PLAYERAUTH_CUSTOM)
{ {
@ -1237,6 +1340,9 @@ void ScorePanel::FillGrid()
} }
} }
} }
// Set Colors for Players
/* @2014 /* @2014
if(g_pTrackerUser) if(g_pTrackerUser)
{ {
@ -1258,6 +1364,12 @@ void ScorePanel::FillGrid()
} }
#endif #endif
break; break;
/* case COLUMN_PLAYER_COLOR:
Preparation for Player Color in own column
pLabel->setImage(m_pCYellow);
pLabel->setFgColorAsImageColor(false);
m_pCYellow->setColor(BuildColor(255, 255, 255, gHUD.GetGammaSlope()));
break;*/
case COLUMN_SCORE: case COLUMN_SCORE:
if(!theIsForEnemy && theLocalPlayerTeam != TEAM_IND || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER)) if(!theIsForEnemy && theLocalPlayerTeam != TEAM_IND || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER))
{ {

View file

@ -9,6 +9,8 @@
#include<VGUI_Label.h> #include<VGUI_Label.h>
#include<VGUI_TextImage.h> #include<VGUI_TextImage.h>
#include "vgui_listbox.h" #include "vgui_listbox.h"
#include <list>
#include <vector>
#include <ctype.h> #include <ctype.h>
@ -96,8 +98,19 @@ private:
vgui::BitmapTGA *m_pGL; vgui::BitmapTGA *m_pGL;
vgui::BitmapTGA *m_pSG; vgui::BitmapTGA *m_pSG;
vgui::BitmapTGA *m_pColorIcons[MAX_PLAYERS];
std::vector<std::vector<int>> player_colors = {
{154,5,102},{199,131,7},{17,59,132},{136,188,6},{203,203,203},{0,0,0,0}
};
std::list<int> players_marine_team ;
std::list<int> players_alien_team;
int m_pColorIndex = -1;
// Player Color indicators
vgui::BitmapTGA *m_pCYellow;
vector< pair <vgui::BitmapTGA *, string> > m_CustomIconList; vector< pair <vgui::BitmapTGA *, string> > m_CustomIconList;
unsigned int m_iIconFrame; unsigned int m_iIconFrame;
unsigned int m_iLastFrameIncrementTime; unsigned int m_iLastFrameIncrementTime;

View file

@ -2559,6 +2559,7 @@ int TeamFortressViewport::MsgFunc_ScoreInfo( const char *pszName, int iSize, voi
// Update score, but show + or - indicator on scoreboard when it changes // Update score, but show + or - indicator on scoreboard when it changes
g_PlayerExtraInfo[info.player_index].lastScore = g_PlayerExtraInfo[info.player_index].score; g_PlayerExtraInfo[info.player_index].lastScore = g_PlayerExtraInfo[info.player_index].score;
g_PlayerExtraInfo[info.player_index].score = info.score; g_PlayerExtraInfo[info.player_index].score = info.score;
g_PlayerExtraInfo[info.player_index].player_index = info.player_index;
if(g_PlayerExtraInfo[info.player_index].score != g_PlayerExtraInfo[info.player_index].lastScore) if(g_PlayerExtraInfo[info.player_index].score != g_PlayerExtraInfo[info.player_index].lastScore)
{ {
g_PlayerExtraInfo[info.player_index].timeOfLastScoreChange = gHUD.GetTimeOfLastUpdate(); g_PlayerExtraInfo[info.player_index].timeOfLastScoreChange = gHUD.GetTimeOfLastUpdate();

Binary file not shown.

View file

@ -145,6 +145,8 @@
#include "../mod/AvHAlienAbilityConstants.h" #include "../mod/AvHAlienAbilityConstants.h"
#include "../mod/AvHNetworkMessages.h" #include "../mod/AvHNetworkMessages.h"
#include "../mod/AvHNexusServer.h" #include "../mod/AvHNexusServer.h"
#include <algorithm>
#include <vector>
#include "../game_shared/voice_gamemgr.h" #include "../game_shared/voice_gamemgr.h"
extern CVoiceGameMgr g_VoiceGameMgr; extern CVoiceGameMgr g_VoiceGameMgr;
@ -159,6 +161,9 @@ extern DLL_GLOBAL ULONG g_ulFrameCount;
extern void CopyToBodyQue(entvars_t* pev); extern void CopyToBodyQue(entvars_t* pev);
extern int g_teamplay; extern int g_teamplay;
vector<int> playerReadyList;
vector<int> playerList;
/* /*
* used by kill command and disconnect command * used by kill command and disconnect command
* ROBIN: Moved here from player.cpp, to allow multiple player models * ROBIN: Moved here from player.cpp, to allow multiple player models
@ -359,6 +364,45 @@ void ClientPutInServer( edict_t *pEntity )
pPlayer->pev->effects |= EF_NOINTERP; pPlayer->pev->effects |= EF_NOINTERP;
} }
void Player_Ready(edict_t* pEntity, bool ready) {
AvHPlayer* theTalkingPlayer = dynamic_cast<AvHPlayer*>(CBaseEntity::Instance(pEntity));
// Player is ready
if (ready){
if (std::find(std::begin(playerReadyList), std::end(playerReadyList), theTalkingPlayer->entindex()) == std::end(playerReadyList)) {
playerReadyList.push_back(theTalkingPlayer->entindex());
g_engfuncs.pfnServerPrint(( "ADD playerReady " +std::to_string(theTalkingPlayer->entindex()) ).c_str());
}
}
else { // Player is not ready
if (std::find(std::begin(playerReadyList), std::end(playerReadyList), theTalkingPlayer->entindex()) != std::end(playerReadyList)) {
playerReadyList.erase(std::find(std::begin(playerReadyList), std::end(playerReadyList), theTalkingPlayer->entindex()));
g_engfuncs.pfnServerPrint(("REMOVE playerReady " + std::to_string(theTalkingPlayer->entindex())).c_str());
}
}
bool allready = true;
// check wether all players are ready
if (playerList.size() >= 12) {
for (int i : playerList) {
if (std::find(std::begin(playerReadyList), std::end(playerReadyList), i) != std::end(playerReadyList)) {
allready = false;
}
}
}
if (allready) {
AvHTeam* teamA = GetGameRules()->GetTeam(AvHTeamNumber::TEAM_ONE);
AvHTeam* teamB = GetGameRules()->GetTeam(AvHTeamNumber::TEAM_TWO);
teamA->SetIsReady();
teamB->SetIsReady();
}
}
//// HOST_SAY //// HOST_SAY
// String comes in as // String comes in as
// say blah blah blah // say blah blah blah
@ -378,6 +422,7 @@ void Host_Say( edict_t *pEntity, int teamonly )
const char* pcmd = CMD_ARGV(0); const char* pcmd = CMD_ARGV(0);
bool theTalkerInReadyRoom = theTalkingPlayer->GetInReadyRoom(); bool theTalkerInReadyRoom = theTalkingPlayer->GetInReadyRoom();
//bool theTalkerIsObserver = (theTalkingPlayer->GetPlayMode() == PLAYMODE_OBSERVER) || (theTalkingPlayer->GetPlayMode() == PLAYMODE_AWAITINGREINFORCEMENT); //bool theTalkerIsObserver = (theTalkingPlayer->GetPlayMode() == PLAYMODE_OBSERVER) || (theTalkingPlayer->GetPlayMode() == PLAYMODE_AWAITINGREINFORCEMENT);
// We can get a raw string now, without the "say " prepended // We can get a raw string now, without the "say " prepended
if ( CMD_ARGC() == 0 ) if ( CMD_ARGC() == 0 )
@ -395,23 +440,31 @@ void Host_Say( edict_t *pEntity, int teamonly )
if(GetGameRules()->GetIsTournamentMode() && !GetGameRules()->GetGameStarted()) if(GetGameRules()->GetIsTournamentMode() && !GetGameRules()->GetGameStarted())
{ {
if(!strcmp(CMD_ARGV(1), kReadyNotification)) if(!strcmp(CMD_ARGV(1), kReadyNotification))
{ {
Player_Ready(pEntity, true);
// Team is ready // Team is ready
/*
AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)(pEntity->v.team)); AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)(pEntity->v.team));
if(theTeam && !theTeam->GetIsReady()) if(theTeam && !theTeam->GetIsReady())
{ {
theTeam->SetIsReady(); theTeam->SetIsReady();
} }
*/
} }
else if (!strcmp(CMD_ARGV(1), kNotReadyNotification)) else if (!strcmp(CMD_ARGV(1), kNotReadyNotification))
{ {
Player_Ready(pEntity, false);
// Team is no longer ready // Team is no longer ready
/*
AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)(pEntity->v.team)); AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)(pEntity->v.team));
if(theTeam && theTeam->GetIsReady()) if(theTeam && theTeam->GetIsReady())
{ {
theTeam->SetIsReady(false); theTeam->SetIsReady(false);
} }
*/
} }
} }
} }
@ -477,6 +530,8 @@ void Host_Say( edict_t *pEntity, int teamonly )
client = NULL; client = NULL;
while ( ((client = (AvHPlayer*)UTIL_FindEntityByClassname( client, "player" )) != NULL) && (!FNullEnt(client->edict())) ) while ( ((client = (AvHPlayer*)UTIL_FindEntityByClassname( client, "player" )) != NULL) && (!FNullEnt(client->edict())) )
{ {
if ( !client->pev ) if ( !client->pev )
continue; continue;
@ -499,6 +554,26 @@ void Host_Say( edict_t *pEntity, int teamonly )
bool theClientInReadyRoom = client->GetInReadyRoom(); bool theClientInReadyRoom = client->GetInReadyRoom();
// Create a list of all players that are on Marine or Alien team
if (client->GetTeam()==TEAM_ONE || client->GetTeam() == TEAM_TWO) {
if (std::find(std::begin(playerList), std::end(playerList), client->entindex()) == std::end(playerList)) {
playerList.push_back(client->entindex());
g_engfuncs.pfnServerPrint(("REMOVE playerList " + std::to_string(theTalkingPlayer->entindex())).c_str());
}
}
else {
playerList.erase(std::find(std::begin(playerList), std::end(playerList), client->entindex()));
g_engfuncs.pfnServerPrint(("REMOVE playerList " + std::to_string(theTalkingPlayer->entindex())).c_str());
// also remove from the ready lists if they are in...
if (std::find(std::begin(playerReadyList), std::end(playerReadyList), client->entindex()) != std::end(playerReadyList)) {
playerReadyList.erase(std::find(std::begin(playerReadyList), std::end(playerReadyList), client->entindex()));
g_engfuncs.pfnServerPrint(("REMOVE playerReady" + std::to_string(theTalkingPlayer->entindex())).c_str());
}
}
if (theClientInReadyRoom != theTalkerInReadyRoom && !theClientIsHLTV) if (theClientInReadyRoom != theTalkerInReadyRoom && !theClientIsHLTV)
{ {
continue; continue;

View file

@ -62,6 +62,10 @@ extern void CreateInstancedBaselines ( void );
extern int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message ); extern int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message );
extern int AllowLagCompensation( void ); extern int AllowLagCompensation( void );
extern void Player_Ready(edict_t* pEntity, bool ready);
extern vector<int> playerReadyList;
extern vector<int> playerList;
//extern bool AvHClientCommand( edict_t *pEntity ); //extern bool AvHClientCommand( edict_t *pEntity );

View file

@ -74,7 +74,7 @@
<OutDir Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'">$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Developer - debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">.\Playtest\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">F:\Steam\steamapps\common\Half-Life\ns\dlls\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">false</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Playtest|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Playtest - balance disabled|Win32'">$(SolutionDir)$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Playtest - balance disabled|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
@ -215,7 +215,7 @@
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\includes\lua\include;$(SolutionDir)\particles\;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\libcurl-7.50-nossl\include;$(SolutionDir)\common;$(SolutionDir)\public;$(SolutionDir)\util;$(SolutionDir)\engine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\includes\lua\include;$(SolutionDir)\particles\;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\libcurl-7.50-nossl\include;$(SolutionDir)\common;$(SolutionDir)\public;$(SolutionDir)\util;$(SolutionDir)\engine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>winmm.lib;ws2_32.lib;particles.lib;lua5.1.lib;libcurl_a.lib;%(AdditionalDependencies);legacy_stdio_definitions.lib</AdditionalDependencies> <AdditionalDependencies>winmm.lib;ws2_32.lib;\..\..\Release\particles.lib;lua5.1.lib;libcurl_a.lib;%(AdditionalDependencies);legacy_stdio_definitions.lib</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreSpecificDefaultLibraries>gdi32.lib user32.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>gdi32.lib user32.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<ModuleDefinitionFile>.\hl.def</ModuleDefinitionFile> <ModuleDefinitionFile>.\hl.def</ModuleDefinitionFile>
@ -230,7 +230,7 @@
<AdditionalLibraryDirectories>$(SolutionDir)includes\lua\lib;$(SolutionDir)particles\Release;$(SolutionDir)includes\libcurl-7.50-nossl;$(SolutionDir)includes\vgui\lib\win32_vc6;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)includes\lua\lib;$(SolutionDir)particles\Release;$(SolutionDir)includes\libcurl-7.50-nossl;$(SolutionDir)includes\vgui\lib\win32_vc6;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress> <RandomizedBaseAddress>false</RandomizedBaseAddress>
<OutputFile>C:\Program Files (x86)\Steam\steamapps\common\Half-Life\ns\dlls\$(TargetName)$(TargetExt)</OutputFile> <OutputFile>F:\Steam\steamapps\common\Half-Life\ns\dlls\$(TargetName)$(TargetExt)</OutputFile>
</Link> </Link>
<Midl> <Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View file

@ -201,6 +201,7 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
mapEntity.mAngle = theBaseEntity->pev->angles[1]; mapEntity.mAngle = theBaseEntity->pev->angles[1];
mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team); mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team);
mapEntity.mPlayerSlot = -1;
mapEntity.mSquadNumber = 0; mapEntity.mSquadNumber = 0;
mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0; mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0;

View file

@ -54,7 +54,7 @@ const int kNumStatusTypes = 15;
class MapEntity class MapEntity
{ {
public: public:
MapEntity(void) : mUser3(AVH_USER3_NONE), mTeam(TEAM_IND), mX(0.0f), mY(0.0f), mAngle(0.0f), mSquadNumber(0), mUnderAttack(0) {} MapEntity(void) : mUser3(AVH_USER3_NONE), mTeam(TEAM_IND), mX(0.0f), mY(0.0f), mAngle(0.0f), mSquadNumber(0), mUnderAttack(0), mPlayerSlot(0), mEntityHealth(0) {}
AvHUser3 mUser3; AvHUser3 mUser3;
AvHTeamNumber mTeam; AvHTeamNumber mTeam;
@ -63,6 +63,8 @@ public:
float mAngle; float mAngle;
int mSquadNumber; int mSquadNumber;
int mUnderAttack; int mUnderAttack;
int mPlayerSlot;
int mEntityHealth;
bool operator==(const MapEntity& e) const bool operator==(const MapEntity& e) const
{ {
@ -72,7 +74,8 @@ public:
mY == e.mY && mY == e.mY &&
mAngle == e.mAngle && mAngle == e.mAngle &&
mUnderAttack == e.mUnderAttack && mUnderAttack == e.mUnderAttack &&
mSquadNumber == e.mSquadNumber; mSquadNumber == e.mSquadNumber &&
mPlayerSlot == e.mPlayerSlot;
} }
bool operator!=(const MapEntity& e) const bool operator!=(const MapEntity& e) const

View file

@ -722,6 +722,7 @@ void AvHHud::DrawPlayerNames()
this->mTopDownPlayerNameMessage.SetIgnoreFadeForLifetime(true); this->mTopDownPlayerNameMessage.SetIgnoreFadeForLifetime(true);
// Set the message info and draw it // Set the message info and draw it
this->mTopDownPlayerNameMessage.SetText(theEntityName); this->mTopDownPlayerNameMessage.SetText(theEntityName);
// Set position // Set position
@ -2946,6 +2947,8 @@ void AvHHud::RenderCommonUI()
hud_player_info_t thePlayerInfo; hud_player_info_t thePlayerInfo;
gEngfuncs.pfnGetPlayerInfo(this->mProgressBarEntityIndex, &thePlayerInfo); gEngfuncs.pfnGetPlayerInfo(this->mProgressBarEntityIndex, &thePlayerInfo);
char* thePlayerName = thePlayerInfo.name; char* thePlayerName = thePlayerInfo.name;
if(thePlayerName) if(thePlayerName)
{ {

View file

@ -2087,6 +2087,8 @@ const int kEntHierFlagUnderAttack = 0x04;
ent.mY = UnpackageCoord(long_data & kPositionCoordinateMask); ent.mY = UnpackageCoord(long_data & kPositionCoordinateMask);
long_data >>= kNumPositionCoordinateBits; long_data >>= kNumPositionCoordinateBits;
ent.mX = UnpackageCoord(long_data & kPositionCoordinateMask); ent.mX = UnpackageCoord(long_data & kPositionCoordinateMask);
if( (flags & kEntHierFlagPlayer) == kEntHierFlagPlayer ) // Player added/changed if( (flags & kEntHierFlagPlayer) == kEntHierFlagPlayer ) // Player added/changed
{ {

View file

@ -13,6 +13,7 @@
#include "AvHSpriteAPI.h" #include "AvHSpriteAPI.h"
#include "AvHSprites.h" #include "AvHSprites.h"
#include "AvHClientVariables.h" #include "AvHClientVariables.h"
#include "AvHServerVariables.h"
using std::string; using std::string;
@ -215,6 +216,8 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
entity.mUser3 == AVH_USER3_ALIENRESTOWER || entity.mUser3 == AVH_USER3_ALIENRESTOWER ||
entity.mUser3 == AVH_USER3_ADVANCED_TURRET_FACTORY; entity.mUser3 == AVH_USER3_ADVANCED_TURRET_FACTORY;
if ( entity.mIsUnderAttack && (entity.mTeam == mTeam || gEngfuncs.IsSpectateOnly() ) ) { if ( entity.mIsUnderAttack && (entity.mTeam == mTeam || gEngfuncs.IsSpectateOnly() ) ) {
if ( gpGlobals && (gpGlobals->time > this->mBlinkTime + attackBlinkPeriod) ) { if ( gpGlobals && (gpGlobals->time > this->mBlinkTime + attackBlinkPeriod) ) {
this->mBlinkOn=!mBlinkOn; this->mBlinkOn=!mBlinkOn;
@ -228,30 +231,104 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
} }
} }
if (entity.mUser3 == AVH_USER3_WAYPOINT) { if (entity.mUser3 == AVH_USER3_WAYPOINT) {
outR = 0.1; outR = 0.1;
outG = 0.8; outG = 0.8;
outB = 1.0; outB = 1.0;
} }
else if (entity.mUser3 == AVH_USER3_WELD) { else if (entity.mUser3 == AVH_USER3_WELD) {
outR = 1.0; outR = 1.0;
outG = 0.7; outG = 0.7;
outB = 0.3; outB = 0.3;
} }
else if ( entity.mUser3 == AVH_USER3_MINE ) { else if (entity.mUser3 == AVH_USER3_MINE) {
outR = 0.05; outR = 0.05;
outG = 0.44; outG = 0.44;
outB = 0.61; outB = 0.61;
} }
else if (entity.mTeam == TEAM_IND) { else if (entity.mTeam == TEAM_IND) {
outR = 0.5; outR = 0.5;
outG = 0.5; outG = 0.5;
outB = 0.5; outB = 0.5;
} }
else if (entity.mTeam == mTeam && !isStructure) { else if (entity.mTeam == mTeam && !isStructure) {
outR = 1.0;
outG = 1.0; thePlayerId = entity.mPlayerSlot;
outB = 1.0; string test = to_string(entity.mPlayerSlot) + '\n';
//ConsolePrint(test.c_str());
if (gHUD.GetServerVariableFloat(kvTournamentMode)) {
switch (entity.mTeam) {
case 1:
if (std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId) == std::end(players_marine_team)) {
players_marine_team.push_back(thePlayerId);
players_marine_team.sort();
}
else if (std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId) != std::end(players_alien_team)) {
players_alien_team.erase(std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId));
players_alien_team.sort();
}
break;
case 2:
if (std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId) == std::end(players_alien_team)) {
players_alien_team.push_back(thePlayerId);
players_alien_team.sort();
}
else if (std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId) != std::end(players_marine_team)) {
players_marine_team.erase(std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId));
players_marine_team.sort();
}
break;
default:
if (std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId) != std::end(players_alien_team)) {
players_alien_team.erase(std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId));
players_alien_team.sort();
}
else if (std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId) != std::end(players_marine_team)) {
players_marine_team.erase(std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId));
players_marine_team.sort();
}
break;
}
string debug_string = "";
switch (entity.mTeam) {
case 1:
m_pColorIndex = std::distance(std::begin(players_marine_team), std::find(std::begin(players_marine_team), std::end(players_marine_team), thePlayerId));
m_pColorIndex = m_pColorIndex % player_colors.size();
outR = player_colors[m_pColorIndex][0] / 255.0;
outG = player_colors[m_pColorIndex][1] / 255.0;
outB = player_colors[m_pColorIndex][2] / 250.0;
//debug_string = "Team: " + to_string(entity.mTeam) + " AltTeam: " + to_string(mTeam) + " PlayerId: " + to_string(thePlayerId) + " Color: " + to_string(player_colors[m_pColorIndex][0]) + " " + to_string(player_colors[m_pColorIndex][1]) + " " + to_string(player_colors[m_pColorIndex][2]) + "\n";
//ConsolePrint(debug_string.c_str());
break;
case 2:
m_pColorIndex = std::distance(std::begin(players_alien_team), std::find(std::begin(players_alien_team), std::end(players_alien_team), thePlayerId));
m_pColorIndex = m_pColorIndex % player_colors.size();
outR = player_colors[m_pColorIndex][0] / 255.0;
outG = player_colors[m_pColorIndex][1] / 255.0;
outB = player_colors[m_pColorIndex][2] / 255.0;
break;
default:
outR = 1.0;
outG = 1.0;
outB = 1.0;
break;
}
}
else {
outR = 1.0;
outG = 1.0;
outB = 1.0;
}
int localPlayerSquad; int localPlayerSquad;
@ -264,7 +341,7 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
localPlayerSquad = 0; localPlayerSquad = 0;
} }
if (mUser3 != AVH_USER3_COMMANDER_PLAYER) { /*if (mUser3 != AVH_USER3_COMMANDER_PLAYER) {
if (entity.mIsLocalPlayer ) { if (entity.mIsLocalPlayer ) {
outR = 0.0; outR = 0.0;
outG = 1.0; outG = 1.0;
@ -275,51 +352,51 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
outG = 1.0; outG = 1.0;
outB = 0.0; outB = 0.0;
} }
} }*/
} }
else { else {
if ( entity.mTeam == TEAM_ONE ) { if (entity.mTeam == TEAM_ONE) {
outR=0.33; outR = 0.33;
outG=0.95; outG = 0.95;
outB=1.0; outB = 1.0;
} }
else if ( entity.mTeam == TEAM_TWO ) { else if (entity.mTeam == TEAM_TWO) {
if ( entity.mUser3 == AVH_USER3_UNKNOWN ) { if (entity.mUser3 == AVH_USER3_UNKNOWN) {
outR=1.0; outR = 1.0;
outG=0.72; outG = 0.72;
outB=0.0; outB = 0.0;
} }
else { else {
outR=1.0; outR = 1.0;
outG=0.85; outG = 0.85;
outB=0.0; outB = 0.0;
} }
} }
else if ( entity.mTeam == TEAM_THREE ) { else if (entity.mTeam == TEAM_THREE) {
outR=0.92; outR = 0.92;
outG=0.1; outG = 0.1;
outB=0.47; outB = 0.47;
} }
else if ( entity.mTeam == TEAM_FOUR ) { else if (entity.mTeam == TEAM_FOUR) {
outR=0.65; outR = 0.65;
outG=0.92; outG = 0.92;
outB=0.0; outB = 0.0;
} }
else { else {
outR=0.0; outR = 0.0;
outG=0.0; outG = 0.0;
outB=0.0; outB = 0.0;
} }
if ( isStructure ) { if (isStructure) {
if ( entity.mTeam == TEAM_ONE ) { if (entity.mTeam == TEAM_ONE) {
outR=0.43; outR = 0.43;
outG=0.70; outG = 0.70;
outB=1.0; outB = 1.0;
} }
else if ( entity.mTeam == TEAM_TWO ) { else if (entity.mTeam == TEAM_TWO) {
outR=0.88; outR = 0.88;
outG=0.45; outG = 0.45;
outB=0.00; outB = 0.00;
} }
} }
} }
@ -370,7 +447,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
bool isPlayer = inEntity.mUser3 == AVH_USER3_MARINE_PLAYER || inEntity.mUser3 == AVH_USER3_HEAVY; //heavy used for player in minimap system bool isPlayer = inEntity.mUser3 == AVH_USER3_MARINE_PLAYER || inEntity.mUser3 == AVH_USER3_HEAVY; //heavy used for player in minimap system
bool theIsWaypoint = inEntity.mUser3 == AVH_USER3_WAYPOINT; bool theIsWaypoint = inEntity.mUser3 == AVH_USER3_WAYPOINT;
float w = theSprWidth * scale; float w = theSprWidth * scale;
float h = theSprHeight * scale; float h = theSprHeight * scale;
@ -424,6 +501,8 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
AvHSpriteSetRenderMode(kRenderTransAdd); AvHSpriteSetRenderMode(kRenderTransAdd);
AvHSpriteDraw(theSprite, theFrame, x2, y2, x2 + w2, y2 + h2, 0, 0, 1, 1); AvHSpriteDraw(theSprite, theFrame, x2, y2, x2 + w2, y2 + h2, 0, 0, 1, 1);
} }
if (mUser3 != AVH_USER3_COMMANDER_PLAYER) if (mUser3 != AVH_USER3_COMMANDER_PLAYER)
@ -438,6 +517,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
AvHSpriteSetColor(r, g, b); AvHSpriteSetColor(r, g, b);
AvHSpriteSetRenderMode(theRenderMode); AvHSpriteSetRenderMode(theRenderMode);
AvHSpriteDraw(theSprite, theFrame, x, y, x + w, y + h, 0, 0, 1, 1); AvHSpriteDraw(theSprite, theFrame, x, y, x + w, y + h, 0, 0, 1, 1);
} }
@ -731,6 +811,7 @@ void AvHOverviewMap::Draw(const DrawInfo& inDrawInfo)
DrawableEntityListType attackedPlayers; DrawableEntityListType attackedPlayers;
DrawableEntityListType players; DrawableEntityListType players;
for (DrawableEntityListType::const_iterator theIter = this->mDrawableEntityList.begin(); theIter != this->mDrawableEntityList.end(); theIter++) for (DrawableEntityListType::const_iterator theIter = this->mDrawableEntityList.begin(); theIter != this->mDrawableEntityList.end(); theIter++)
{ {
if ( (*theIter).mUser3 > AVH_USER3_NONE && (*theIter).mUser3 <= AVH_USER3_ALIEN_EMBRYO ) { if ( (*theIter).mUser3 > AVH_USER3_NONE && (*theIter).mUser3 <= AVH_USER3_ALIEN_EMBRYO ) {
@ -753,6 +834,7 @@ void AvHOverviewMap::Draw(const DrawInfo& inDrawInfo)
for (DrawableEntityListType::const_iterator theIter = players.begin(); theIter != players.end(); theIter++) for (DrawableEntityListType::const_iterator theIter = players.begin(); theIter != players.end(); theIter++)
{ {
DrawMiniMapEntity(inDrawInfo, *theIter); DrawMiniMapEntity(inDrawInfo, *theIter);
} }
for (DrawableEntityListType::const_iterator theIter = attackedPlayers.begin(); theIter != attackedPlayers.end(); theIter++) for (DrawableEntityListType::const_iterator theIter = attackedPlayers.begin(); theIter != attackedPlayers.end(); theIter++)
@ -901,7 +983,7 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
{ {
theLocalPlayerIndex = g_iUser2; theLocalPlayerIndex = g_iUser2;
} }
cl_entity_s* thePlayer = gEngfuncs.GetEntityByIndex(theLocalPlayerIndex); cl_entity_s* thePlayer = gEngfuncs.GetEntityByIndex(theLocalPlayerIndex);
mTeam = (AvHTeamNumber)(thePlayer->curstate.team); mTeam = (AvHTeamNumber)(thePlayer->curstate.team);
@ -929,7 +1011,9 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
theDrawableEntity.mAngleRadians = theIter->second.mAngle * M_PI / 180; theDrawableEntity.mAngleRadians = theIter->second.mAngle * M_PI / 180;
theDrawableEntity.mSquadNumber = theIter->second.mSquadNumber; theDrawableEntity.mSquadNumber = theIter->second.mSquadNumber;
theDrawableEntity.mIsUnderAttack = theIter->second.mUnderAttack; theDrawableEntity.mIsUnderAttack = theIter->second.mUnderAttack;
theDrawableEntity.mPlayerSlot = theIter->first;
theDrawableEntity.mHealth = theIter->second.mEntityHealth;
// Returns position relative to minimap, so add it back in // Returns position relative to minimap, so add it back in
// commented this out here, commented out corresponding shift in AvHEntityHierarchy::BuildFromTeam at line 234 // commented this out here, commented out corresponding shift in AvHEntityHierarchy::BuildFromTeam at line 234
// theDrawableEntity.mX += this->mMapExtents.GetMinMapX(); // theDrawableEntity.mX += this->mMapExtents.GetMinMapX();

View file

@ -4,11 +4,12 @@
#include "AvHEntityHierarchy.h" #include "AvHEntityHierarchy.h"
#include "AvHMapExtents.h" #include "AvHMapExtents.h"
#include "AvHOrder.h" #include "AvHOrder.h"
#include <list>
class DrawableEntity class DrawableEntity
{ {
public: public:
DrawableEntity() : mUser3(AVH_USER3_NONE), mIsAlive(true), mX(0), mY(0), mAngleRadians(0), mIsLocalPlayer(false), mEntityNumber(0), mTeam(TEAM_IND), mSquadNumber(0), mIsUnderAttack(0) DrawableEntity() : mUser3(AVH_USER3_NONE), mIsAlive(true), mX(0), mY(0), mAngleRadians(0), mIsLocalPlayer(false), mEntityNumber(0), mTeam(TEAM_IND), mSquadNumber(0), mIsUnderAttack(0), mPlayerSlot(0), mHealth(0)
{} {}
AvHUser3 mUser3; AvHUser3 mUser3;
@ -21,6 +22,8 @@ public:
bool mIsLocalPlayer; bool mIsLocalPlayer;
int mEntityNumber; int mEntityNumber;
int mSquadNumber; int mSquadNumber;
int mPlayerSlot; // todo currently mEntityNumber is used which is not necessarily equal to the PlayerSlot
int mHealth; //todo
}; };
class AvHOverviewMap class AvHOverviewMap
@ -44,6 +47,17 @@ public:
bool mFullScreen; bool mFullScreen;
bool mCommander; bool mCommander;
}; };
std::vector<std::vector<int>> player_colors = {
// {255,0,0}, {0,255,0}, {0,0,255}, {2,181,160}, {249, 175,31}, {0,0,0}, {118,122,121}
// {255,192,203}, {0,255,0}, {0,0,255}, {2,181,160}, {249, 175,31}, {255,255,255}
// {154,5,102},{199,131,7},{17,59,132},{136,188,6},{203,203,203},{0,0,0,0}
{191,23,170},{255,148,31},{28,136,177},{203,247,30},{203,203,203},{0,0,0,0}
};
std::list<int> players_marine_team;
std::list<int> players_alien_team;
int m_pColorIndex = -1;
int thePlayerId = -1;
AvHOverviewMap(); AvHOverviewMap();
void Clear(); void Clear();

View file

@ -847,6 +847,8 @@ private:
int mNumSensory; int mNumSensory;
int mNumDefense; int mNumDefense;
bool mIsReady; // for tournamentmode, if player is ready
struct ServerVariable struct ServerVariable
{ {
const cvar_t* mCvar; const cvar_t* mCvar;