diff --git a/main/cl_dlls/client.dll b/main/cl_dlls/client.dll deleted file mode 100644 index 08d0f97e..00000000 Binary files a/main/cl_dlls/client.dll and /dev/null differ diff --git a/main/source/Natural_Selection.sdf b/main/source/Natural_Selection.sdf index ca8ed647..b5dfe95b 100644 Binary files a/main/source/Natural_Selection.sdf and b/main/source/Natural_Selection.sdf differ diff --git a/main/source/Natural_Selection.sln b/main/source/Natural_Selection.sln index 8f096ebf..be1ad424 100644 --- a/main/source/Natural_Selection.sln +++ b/main/source/Natural_Selection.sln @@ -1,19 +1,28 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29911.84 MinimumVisualStudioVersion = 10.0.40219.1 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 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ns.dll", "dlls\hl.vcxproj", "{BC87A180-F17B-83FC-5D7D-470FAD003ABC}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "particles", "particles\particles.vcxproj", "{5AADD469-7488-4B34-A9FD-01CFAC5972FD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 Developer - debug|Win32 = Developer - debug|Win32 Developer - release|Win32 = Developer - release|Win32 Playtest - balance disabled|Win32 = Playtest - balance disabled|Win32 Playtest|Win32 = Playtest|Win32 + Release|Win32 = Release|Win32 EndGlobalSection 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.Build.0 = 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|Win32.ActiveCfg = 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 - 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.Build.0 = Playtest - balance disabled|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}.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 GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D404BD1D-513A-4DF3-BAB1-7BB1ED64C225} + EndGlobalSection EndGlobal diff --git a/main/source/cl_dll/Playtest/cl_dll.exp b/main/source/cl_dll/Playtest/cl_dll.exp new file mode 100644 index 00000000..9d3489a9 Binary files /dev/null and b/main/source/cl_dll/Playtest/cl_dll.exp differ diff --git a/main/source/cl_dll/Playtest/cl_dll.lib b/main/source/cl_dll/Playtest/cl_dll.lib new file mode 100644 index 00000000..59d4418d Binary files /dev/null and b/main/source/cl_dll/Playtest/cl_dll.lib differ diff --git a/main/source/cl_dll/chudmisc.h b/main/source/cl_dll/chudmisc.h index 4a45099c..b0089073 100644 --- a/main/source/cl_dll/chudmisc.h +++ b/main/source/cl_dll/chudmisc.h @@ -241,6 +241,7 @@ struct extra_player_info_t short playerclass; short extra; short auth; + short player_index; short teamnumber; char teamname[MAX_TEAM_NAME]; char customicon[CUSTOM_ICON_LENGTH + 3]; //last 3 characters is the color. diff --git a/main/source/cl_dll/cl_dll.exp b/main/source/cl_dll/cl_dll.exp new file mode 100644 index 00000000..ec303505 Binary files /dev/null and b/main/source/cl_dll/cl_dll.exp differ diff --git a/main/source/cl_dll/cl_dll.lib b/main/source/cl_dll/cl_dll.lib new file mode 100644 index 00000000..59d4418d Binary files /dev/null and b/main/source/cl_dll/cl_dll.lib differ diff --git a/main/source/cl_dll/cl_dll.vcxproj b/main/source/cl_dll/cl_dll.vcxproj index 6ac6a83a..b682ae9c 100644 --- a/main/source/cl_dll/cl_dll.vcxproj +++ b/main/source/cl_dll/cl_dll.vcxproj @@ -33,8 +33,8 @@ <_ProjectFileVersion>10.0.30319.1 - .\release - $(Configuration)\ + F:\Steam\steamapps\common\Half-Life\ns\cl_dlls + . $(TargetPath)%3b*.obj%3b*.ilk%3b*.pdb%3b*.tlb%3b*.tli%3b*.tlh%3b*.tmp%3b*.rsp%3b*.bat false client @@ -72,7 +72,7 @@ false - particles.lib;vgui.lib;zlib.lib;libpng.lib;wsock32.lib;sdl2.lib;opengl32.lib;%(AdditionalDependencies) + \..\..\Release\particles.lib;vgui.lib;zlib.lib;libpng.lib;wsock32.lib;sdl2.lib;opengl32.lib;%(AdditionalDependencies) true $(SolutionDir)\particles\Release;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\vgui\lib\win32_vc6;$(SolutionDir)\lib\public;%(AdditionalLibraryDirectories) @@ -89,7 +89,7 @@ /NODEFAULTLIB:LIBCMT %(AdditionalOptions) - $(SolutionDir)..\cl_dlls\client.dll + F:\Steam\steamapps\common\Half-Life\ns\cl_dlls\client.dll NDEBUG;%(PreprocessorDefinitions) diff --git a/main/source/cl_dll/cl_dll.vcxproj.FileListAbsolute.txt b/main/source/cl_dll/cl_dll.vcxproj.FileListAbsolute.txt new file mode 100644 index 00000000..e69de29b diff --git a/main/source/cl_dll/cl_dll.vcxproj.user b/main/source/cl_dll/cl_dll.vcxproj.user index 14cbff20..b33f0600 100644 --- a/main/source/cl_dll/cl_dll.vcxproj.user +++ b/main/source/cl_dll/cl_dll.vcxproj.user @@ -1,10 +1,10 @@  - ..\..\..\..\..\..\..\Program Files %28x86%29\Steam\SteamApps\common\Half-Life\hl.exe + F:\Steam\steamapps\common\Half-Life\hl.exe WindowsLocalDebugger -allowdebug -dev -steam -game ns - ..\.. + ..\..\..\..\..\..\Steam\steamapps\common\Half-Life\ns false Auto diff --git a/main/source/cl_dll/vgui_ScorePanel.cpp b/main/source/cl_dll/vgui_ScorePanel.cpp index 38a6ca34..b820283c 100644 --- a/main/source/cl_dll/vgui_ScorePanel.cpp +++ b/main/source/cl_dll/vgui_ScorePanel.cpp @@ -81,6 +81,12 @@ #include "mod/AvHServerVariables.h" #include "util/STLUtil.h" #include "ui/ScoreboardIcon.h" +#include +#include +#include +#include "AvHServerVariables.h" + +using namespace std; /* @2014 #include "common/itrackeruser.h" 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 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 theBytesRead = 0; @@ -187,16 +204,16 @@ vgui::Color BuildColor( int R, int G, int B, float gamma ) //----------------------------------------------------------------------------- // 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 hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text"); SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text"); - Font *tfont = pSchemes->getFont(hTitleScheme); - Font *smallfont = pSchemes->getFont(hSmallScheme); - Font *tinyfont = pSchemes->getFont(hTinyScheme); - + Font* tfont = pSchemes->getFont(hTitleScheme); + Font* smallfont = pSchemes->getFont(hSmallScheme); + Font* tinyfont = pSchemes->getFont(hTinyScheme); + setBgColor(0, 0, 0, 96); m_pCurrentHighlightLabel = NULL; 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_pCheatingDeathIcon = NULL; m_pVeteranIcon = NULL; - + m_pHMG = NULL; m_pMine = 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_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga"); - m_pHMG = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardhmg.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_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. m_TitleLabel.setFont(tfont); @@ -811,6 +839,7 @@ void ScorePanel::FillGrid() hud_player_info_t* pl_info = &g_PlayerInfoList[theSortedRow]; extra_player_info_t* theExtraPlayerInfo = &g_PlayerExtraInfo[theSortedRow]; int thePlayerClass = theExtraPlayerInfo->playerclass; + int thePlayerId = theExtraPlayerInfo->player_index; short theTeamNumber = theExtraPlayerInfo->teamnumber; string theCustomIcon = (string)theExtraPlayerInfo->customicon; // : 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) { - 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; case COLUMN_VOICE: sz[0] = 0; @@ -1198,7 +1300,8 @@ void ScorePanel::FillGrid() pLabel->setFgColorAsImageColor(false); m_pServerOpIcon->setColor(BuildColor(0, 255, 0, gHUD.GetGammaSlope())); } - + + // Allow custom icons to override other general icons if(thePlayerAuthentication & PLAYERAUTH_CUSTOM) { @@ -1237,6 +1340,9 @@ void ScorePanel::FillGrid() } } } + // Set Colors for Players + + /* @2014 if(g_pTrackerUser) { @@ -1258,6 +1364,12 @@ void ScorePanel::FillGrid() } #endif 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: if(!theIsForEnemy && theLocalPlayerTeam != TEAM_IND || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER)) { diff --git a/main/source/cl_dll/vgui_ScorePanel.h b/main/source/cl_dll/vgui_ScorePanel.h index 5558a1da..5b92db68 100644 --- a/main/source/cl_dll/vgui_ScorePanel.h +++ b/main/source/cl_dll/vgui_ScorePanel.h @@ -9,6 +9,8 @@ #include #include #include "vgui_listbox.h" +#include +#include #include @@ -96,8 +98,19 @@ private: vgui::BitmapTGA *m_pGL; vgui::BitmapTGA *m_pSG; + vgui::BitmapTGA *m_pColorIcons[MAX_PLAYERS]; + std::vector> player_colors = { + {154,5,102},{199,131,7},{17,59,132},{136,188,6},{203,203,203},{0,0,0,0} + }; + std::list players_marine_team ; + std::list players_alien_team; + int m_pColorIndex = -1; + // Player Color indicators + vgui::BitmapTGA *m_pCYellow; + vector< pair > m_CustomIconList; + unsigned int m_iIconFrame; unsigned int m_iLastFrameIncrementTime; diff --git a/main/source/cl_dll/vgui_TeamFortressViewport.cpp b/main/source/cl_dll/vgui_TeamFortressViewport.cpp index 8247595d..4fb5e6d7 100644 --- a/main/source/cl_dll/vgui_TeamFortressViewport.cpp +++ b/main/source/cl_dll/vgui_TeamFortressViewport.cpp @@ -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 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].player_index = info.player_index; if(g_PlayerExtraInfo[info.player_index].score != g_PlayerExtraInfo[info.player_index].lastScore) { g_PlayerExtraInfo[info.player_index].timeOfLastScoreChange = gHUD.GetTimeOfLastUpdate(); diff --git a/main/source/dlls/Playtest/vc141.idb b/main/source/dlls/Playtest/vc141.idb new file mode 100644 index 00000000..4305d8b6 Binary files /dev/null and b/main/source/dlls/Playtest/vc141.idb differ diff --git a/main/source/dlls/client.cpp b/main/source/dlls/client.cpp index 2a2b6402..7704d0e7 100644 --- a/main/source/dlls/client.cpp +++ b/main/source/dlls/client.cpp @@ -145,6 +145,8 @@ #include "../mod/AvHAlienAbilityConstants.h" #include "../mod/AvHNetworkMessages.h" #include "../mod/AvHNexusServer.h" +#include +#include #include "../game_shared/voice_gamemgr.h" extern CVoiceGameMgr g_VoiceGameMgr; @@ -159,6 +161,9 @@ extern DLL_GLOBAL ULONG g_ulFrameCount; extern void CopyToBodyQue(entvars_t* pev); extern int g_teamplay; + +vector playerReadyList; +vector playerList; /* * used by kill command and disconnect command * 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; } + +void Player_Ready(edict_t* pEntity, bool ready) { + AvHPlayer* theTalkingPlayer = dynamic_cast(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 // String comes in as // say blah blah blah @@ -378,6 +422,7 @@ void Host_Say( edict_t *pEntity, int teamonly ) const char* pcmd = CMD_ARGV(0); bool theTalkerInReadyRoom = theTalkingPlayer->GetInReadyRoom(); //bool theTalkerIsObserver = (theTalkingPlayer->GetPlayMode() == PLAYMODE_OBSERVER) || (theTalkingPlayer->GetPlayMode() == PLAYMODE_AWAITINGREINFORCEMENT); + // We can get a raw string now, without the "say " prepended if ( CMD_ARGC() == 0 ) @@ -395,23 +440,31 @@ void Host_Say( edict_t *pEntity, int teamonly ) if(GetGameRules()->GetIsTournamentMode() && !GetGameRules()->GetGameStarted()) { + + if(!strcmp(CMD_ARGV(1), kReadyNotification)) { + Player_Ready(pEntity, true); // Team is ready + /* AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)(pEntity->v.team)); if(theTeam && !theTeam->GetIsReady()) { theTeam->SetIsReady(); } + */ } else if (!strcmp(CMD_ARGV(1), kNotReadyNotification)) { + Player_Ready(pEntity, false); // Team is no longer ready + /* AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)(pEntity->v.team)); if(theTeam && theTeam->GetIsReady()) { theTeam->SetIsReady(false); } + */ } } } @@ -477,6 +530,8 @@ void Host_Say( edict_t *pEntity, int teamonly ) client = NULL; while ( ((client = (AvHPlayer*)UTIL_FindEntityByClassname( client, "player" )) != NULL) && (!FNullEnt(client->edict())) ) { + + if ( !client->pev ) continue; @@ -499,6 +554,26 @@ void Host_Say( edict_t *pEntity, int teamonly ) 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) { continue; diff --git a/main/source/dlls/client.h b/main/source/dlls/client.h index d3d9a0c5..df5c2a22 100644 --- a/main/source/dlls/client.h +++ b/main/source/dlls/client.h @@ -62,6 +62,10 @@ extern void CreateInstancedBaselines ( void ); extern int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message ); extern int AllowLagCompensation( void ); +extern void Player_Ready(edict_t* pEntity, bool ready); + +extern vector playerReadyList; +extern vector playerList; //extern bool AvHClientCommand( edict_t *pEntity ); diff --git a/main/source/dlls/hl.vcxproj b/main/source/dlls/hl.vcxproj index c0272c42..ca76535d 100644 --- a/main/source/dlls/hl.vcxproj +++ b/main/source/dlls/hl.vcxproj @@ -74,7 +74,7 @@ $(SolutionDir)$(Configuration)\ $(Configuration)\ true - .\Playtest\ + F:\Steam\steamapps\common\Half-Life\ns\dlls\ $(Configuration)\ false $(SolutionDir)$(Configuration)\ @@ -215,7 +215,7 @@ $(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) - winmm.lib;ws2_32.lib;particles.lib;lua5.1.lib;libcurl_a.lib;%(AdditionalDependencies);legacy_stdio_definitions.lib + winmm.lib;ws2_32.lib;\..\..\Release\particles.lib;lua5.1.lib;libcurl_a.lib;%(AdditionalDependencies);legacy_stdio_definitions.lib true gdi32.lib user32.lib;%(IgnoreSpecificDefaultLibraries) .\hl.def @@ -230,7 +230,7 @@ $(SolutionDir)includes\lua\lib;$(SolutionDir)particles\Release;$(SolutionDir)includes\libcurl-7.50-nossl;$(SolutionDir)includes\vgui\lib\win32_vc6;%(AdditionalLibraryDirectories) false false - C:\Program Files (x86)\Steam\steamapps\common\Half-Life\ns\dlls\$(TargetName)$(TargetExt) + F:\Steam\steamapps\common\Half-Life\ns\dlls\$(TargetName)$(TargetExt) NDEBUG;%(PreprocessorDefinitions) diff --git a/main/source/mod/AvHEntityHierarchy.cpp b/main/source/mod/AvHEntityHierarchy.cpp index fe677888..80a2974b 100644 --- a/main/source/mod/AvHEntityHierarchy.cpp +++ b/main/source/mod/AvHEntityHierarchy.cpp @@ -201,6 +201,7 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType mapEntity.mAngle = theBaseEntity->pev->angles[1]; mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team); + mapEntity.mPlayerSlot = -1; mapEntity.mSquadNumber = 0; mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0; diff --git a/main/source/mod/AvHEntityHierarchy.h b/main/source/mod/AvHEntityHierarchy.h index 66aaeb5d..f64b89ed 100644 --- a/main/source/mod/AvHEntityHierarchy.h +++ b/main/source/mod/AvHEntityHierarchy.h @@ -54,7 +54,7 @@ const int kNumStatusTypes = 15; class MapEntity { 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; AvHTeamNumber mTeam; @@ -63,6 +63,8 @@ public: float mAngle; int mSquadNumber; int mUnderAttack; + int mPlayerSlot; + int mEntityHealth; bool operator==(const MapEntity& e) const { @@ -72,7 +74,8 @@ public: mY == e.mY && mAngle == e.mAngle && mUnderAttack == e.mUnderAttack && - mSquadNumber == e.mSquadNumber; + mSquadNumber == e.mSquadNumber && + mPlayerSlot == e.mPlayerSlot; } bool operator!=(const MapEntity& e) const diff --git a/main/source/mod/AvHHudRender.cpp b/main/source/mod/AvHHudRender.cpp index cd626d82..398f4678 100644 --- a/main/source/mod/AvHHudRender.cpp +++ b/main/source/mod/AvHHudRender.cpp @@ -722,6 +722,7 @@ void AvHHud::DrawPlayerNames() this->mTopDownPlayerNameMessage.SetIgnoreFadeForLifetime(true); // Set the message info and draw it + this->mTopDownPlayerNameMessage.SetText(theEntityName); // Set position @@ -2946,6 +2947,8 @@ void AvHHud::RenderCommonUI() hud_player_info_t thePlayerInfo; gEngfuncs.pfnGetPlayerInfo(this->mProgressBarEntityIndex, &thePlayerInfo); + + char* thePlayerName = thePlayerInfo.name; if(thePlayerName) { diff --git a/main/source/mod/AvHNetworkMessages.cpp b/main/source/mod/AvHNetworkMessages.cpp index 83ea9f4b..7feaeea2 100644 --- a/main/source/mod/AvHNetworkMessages.cpp +++ b/main/source/mod/AvHNetworkMessages.cpp @@ -2087,6 +2087,8 @@ const int kEntHierFlagUnderAttack = 0x04; ent.mY = UnpackageCoord(long_data & kPositionCoordinateMask); long_data >>= kNumPositionCoordinateBits; ent.mX = UnpackageCoord(long_data & kPositionCoordinateMask); + + if( (flags & kEntHierFlagPlayer) == kEntHierFlagPlayer ) // Player added/changed { diff --git a/main/source/mod/AvHOverviewMap.cpp b/main/source/mod/AvHOverviewMap.cpp index 5a4953bf..5933a066 100644 --- a/main/source/mod/AvHOverviewMap.cpp +++ b/main/source/mod/AvHOverviewMap.cpp @@ -13,6 +13,7 @@ #include "AvHSpriteAPI.h" #include "AvHSprites.h" #include "AvHClientVariables.h" +#include "AvHServerVariables.h" using std::string; @@ -215,6 +216,8 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR entity.mUser3 == AVH_USER3_ALIENRESTOWER || entity.mUser3 == AVH_USER3_ADVANCED_TURRET_FACTORY; + + if ( entity.mIsUnderAttack && (entity.mTeam == mTeam || gEngfuncs.IsSpectateOnly() ) ) { if ( gpGlobals && (gpGlobals->time > this->mBlinkTime + attackBlinkPeriod) ) { this->mBlinkOn=!mBlinkOn; @@ -228,30 +231,104 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR } } - if (entity.mUser3 == AVH_USER3_WAYPOINT) { - outR = 0.1; - outG = 0.8; + if (entity.mUser3 == AVH_USER3_WAYPOINT) { + outR = 0.1; + outG = 0.8; outB = 1.0; } - else if (entity.mUser3 == AVH_USER3_WELD) { - outR = 1.0; - outG = 0.7; - outB = 0.3; - } - else if ( entity.mUser3 == AVH_USER3_MINE ) { + else if (entity.mUser3 == AVH_USER3_WELD) { + outR = 1.0; + outG = 0.7; + outB = 0.3; + } + else if (entity.mUser3 == AVH_USER3_MINE) { outR = 0.05; - outG = 0.44; + outG = 0.44; outB = 0.61; } - else if (entity.mTeam == TEAM_IND) { + else if (entity.mTeam == TEAM_IND) { outR = 0.5; outG = 0.5; outB = 0.5; - } + } else if (entity.mTeam == mTeam && !isStructure) { - outR = 1.0; - outG = 1.0; - outB = 1.0; + + thePlayerId = entity.mPlayerSlot; + 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; @@ -264,7 +341,7 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR localPlayerSquad = 0; } - if (mUser3 != AVH_USER3_COMMANDER_PLAYER) { + /*if (mUser3 != AVH_USER3_COMMANDER_PLAYER) { if (entity.mIsLocalPlayer ) { outR = 0.0; outG = 1.0; @@ -275,51 +352,51 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR outG = 1.0; outB = 0.0; } - } + }*/ } - else { - if ( entity.mTeam == TEAM_ONE ) { - outR=0.33; - outG=0.95; - outB=1.0; + else { + if (entity.mTeam == TEAM_ONE) { + outR = 0.33; + outG = 0.95; + outB = 1.0; } - else if ( entity.mTeam == TEAM_TWO ) { - if ( entity.mUser3 == AVH_USER3_UNKNOWN ) { - outR=1.0; - outG=0.72; - outB=0.0; + else if (entity.mTeam == TEAM_TWO) { + if (entity.mUser3 == AVH_USER3_UNKNOWN) { + outR = 1.0; + outG = 0.72; + outB = 0.0; } else { - outR=1.0; - outG=0.85; - outB=0.0; + outR = 1.0; + outG = 0.85; + outB = 0.0; } } - else if ( entity.mTeam == TEAM_THREE ) { - outR=0.92; - outG=0.1; - outB=0.47; + else if (entity.mTeam == TEAM_THREE) { + outR = 0.92; + outG = 0.1; + outB = 0.47; } - else if ( entity.mTeam == TEAM_FOUR ) { - outR=0.65; - outG=0.92; - outB=0.0; + else if (entity.mTeam == TEAM_FOUR) { + outR = 0.65; + outG = 0.92; + outB = 0.0; } else { - outR=0.0; - outG=0.0; - outB=0.0; + outR = 0.0; + outG = 0.0; + outB = 0.0; } - if ( isStructure ) { - if ( entity.mTeam == TEAM_ONE ) { - outR=0.43; - outG=0.70; - outB=1.0; + if (isStructure) { + if (entity.mTeam == TEAM_ONE) { + outR = 0.43; + outG = 0.70; + outB = 1.0; } - else if ( entity.mTeam == TEAM_TWO ) { - outR=0.88; - outG=0.45; - outB=0.00; + else if (entity.mTeam == TEAM_TWO) { + outR = 0.88; + outG = 0.45; + 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 theIsWaypoint = inEntity.mUser3 == AVH_USER3_WAYPOINT; - + float w = theSprWidth * scale; float h = theSprHeight * scale; @@ -424,6 +501,8 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl AvHSpriteSetRenderMode(kRenderTransAdd); AvHSpriteDraw(theSprite, theFrame, x2, y2, x2 + w2, y2 + h2, 0, 0, 1, 1); + + } if (mUser3 != AVH_USER3_COMMANDER_PLAYER) @@ -438,6 +517,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl AvHSpriteSetColor(r, g, b); AvHSpriteSetRenderMode(theRenderMode); 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 players; + 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 ) { @@ -753,6 +834,7 @@ void AvHOverviewMap::Draw(const DrawInfo& inDrawInfo) for (DrawableEntityListType::const_iterator theIter = players.begin(); theIter != players.end(); theIter++) { DrawMiniMapEntity(inDrawInfo, *theIter); + } for (DrawableEntityListType::const_iterator theIter = attackedPlayers.begin(); theIter != attackedPlayers.end(); theIter++) @@ -901,7 +983,7 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime) { theLocalPlayerIndex = g_iUser2; } - + cl_entity_s* thePlayer = gEngfuncs.GetEntityByIndex(theLocalPlayerIndex); mTeam = (AvHTeamNumber)(thePlayer->curstate.team); @@ -929,7 +1011,9 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime) theDrawableEntity.mAngleRadians = theIter->second.mAngle * M_PI / 180; theDrawableEntity.mSquadNumber = theIter->second.mSquadNumber; theDrawableEntity.mIsUnderAttack = theIter->second.mUnderAttack; - + theDrawableEntity.mPlayerSlot = theIter->first; + theDrawableEntity.mHealth = theIter->second.mEntityHealth; + // Returns position relative to minimap, so add it back in // commented this out here, commented out corresponding shift in AvHEntityHierarchy::BuildFromTeam at line 234 // theDrawableEntity.mX += this->mMapExtents.GetMinMapX(); diff --git a/main/source/mod/AvHOverviewMap.h b/main/source/mod/AvHOverviewMap.h index de6f3367..3d4a6021 100644 --- a/main/source/mod/AvHOverviewMap.h +++ b/main/source/mod/AvHOverviewMap.h @@ -4,11 +4,12 @@ #include "AvHEntityHierarchy.h" #include "AvHMapExtents.h" #include "AvHOrder.h" +#include class DrawableEntity { 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; @@ -21,6 +22,8 @@ public: bool mIsLocalPlayer; int mEntityNumber; int mSquadNumber; + int mPlayerSlot; // todo currently mEntityNumber is used which is not necessarily equal to the PlayerSlot + int mHealth; //todo }; class AvHOverviewMap @@ -44,6 +47,17 @@ public: bool mFullScreen; bool mCommander; }; + + std::vector> 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 players_marine_team; + std::list players_alien_team; + int m_pColorIndex = -1; + int thePlayerId = -1; AvHOverviewMap(); void Clear(); diff --git a/main/source/mod/AvHPlayer.h b/main/source/mod/AvHPlayer.h index 4f5fda08..505b4a52 100644 --- a/main/source/mod/AvHPlayer.h +++ b/main/source/mod/AvHPlayer.h @@ -847,6 +847,8 @@ private: int mNumSensory; int mNumDefense; + bool mIsReady; // for tournamentmode, if player is ready + struct ServerVariable { const cvar_t* mCvar;