Minimap update

+ Colored Players
+ Colored Structures / Different colors for unbuild/build structures
This commit is contained in:
Gerhard Klassen 2020-03-29 17:47:47 +02:00
parent 8674080504
commit ba163d233e
11 changed files with 1905 additions and 1833 deletions

View file

@ -49,7 +49,7 @@
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_NETWORK_METERING;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>

Binary file not shown.

View file

@ -163,7 +163,8 @@ extern int g_teamplay;
vector<int> playerReadyList;
vector<int> playerList;
vector<int> marinesPlayerList;
vector<int> aliensPlayerList;
/*
* used by kill command and disconnect command
* ROBIN: Moved here from player.cpp, to allow multiple player models
@ -368,38 +369,57 @@ void ClientPutInServer( edict_t *pEntity )
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());
}
//if (theTalkingPlayer->GetTeam == TEAM_ONE || theTalkingPlayer->GetTeam == TEAM_TWO) {
// 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();
}
// Loop trough all players
//AvHPlayer* client = NULL;
//while (((client = (AvHPlayer*)UTIL_FindEntityByClassname(client, "player")) != NULL) && (!FNullEnt(client->edict()))) {
// if (client->GetTeam == AvHTeamNumber::TEAM_ONE){
// marinesPlayerList.push_back(client->entindex);
//
// }
// else if (client->GetTeam == AvHTeamNumber::TEAM_TWO) {
// aliensPlayerList.push_back(client->entindex);
// }
// // in case someone left the team remove him
// if (std::find(std::begin(aliensPlayerList), std::end(aliensPlayerList), client->entindex) != std::end(aliensPlayerList)) {
// aliensPlayerList.erase(std::find(std::begin(aliensPlayerList), std::end(aliensPlayerList), client->entindex));
// }
// if (std::find(std::begin(marinesPlayerList), std::end(marinesPlayerList), client->entindex) != std::end(marinesPlayerList)) {
// marinesPlayerList.erase(std::find(std::begin(aliensPlayerList), std::end(aliensPlayerList), client->entindex));
// }
//}
//bool allready = true;
// check wether all players are ready
//if (marinesPlayerList.size() >= 12) {
// for (int i : marinesPlayerList) {
// if (std::find(std::begin(playerReadyList), std::end(playerReadyList), i) != std::end(playerReadyList)) {
// allready = false;
// }
// }
//}
}
@ -444,27 +464,27 @@ void Host_Say( edict_t *pEntity, int teamonly )
if(!strcmp(CMD_ARGV(1), kReadyNotification))
{
Player_Ready(pEntity, true);
//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);
}
*/
}
}
}
@ -555,25 +575,6 @@ 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;
@ -919,6 +920,7 @@ void ParmsChangeLevel( void )
if ( pSaveData )
pSaveData->connectionCount = BuildChangeList( pSaveData->levelList, MAX_LEVEL_CONNECTIONS );
}
void ShowMenu(entvars_s *pev, int ValidSlots, int DisplayTime, BOOL ShowLater, char Menu[500])

View file

@ -65,7 +65,8 @@ extern int AllowLagCompensation( void );
extern void Player_Ready(edict_t* pEntity, bool ready);
extern vector<int> playerReadyList;
extern vector<int> playerList;
extern vector<int> alienPlayersList;
extern vector<int> marinePlayersList;
//extern bool AvHClientCommand( edict_t *pEntity );

View file

@ -248,7 +248,7 @@ void GameDLLInit( void )
#ifdef USE_NETWORK_METERING
CVAR_REGISTER (&avh_networkdebug);
CVAR_REGISTER (&avh_drawinvisible);
// CVAR_REGISTER (&avh_drawinvisible);
#endif
#ifdef PROFILE_BUILD

View file

@ -195,7 +195,7 @@
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;AVH_NO_NEXUS;USE_OLDAUTH</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_NETWORK_METERING;NDEBUG;WIN32;_WINDOWS;QUIVER;VOXEL;QUAKE2;VALVE_DLL;AVH_SERVER;AVH_NO_NEXUS;USE_OLDAUTH</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

File diff suppressed because it is too large Load diff

View file

@ -253,7 +253,9 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
}
else if (entity.mTeam == mTeam && !isStructure) {
thePlayerId = entity.mPlayerSlot;
cl_entity_s* theEntity = gEngfuncs.GetEntityByIndex(entity.mEntityNumber);
thePlayerId = theEntity->curstate.number;
string test = to_string(entity.mPlayerSlot) + '\n';
//ConsolePrint(test.c_str());
if (gHUD.GetServerVariableFloat(kvTournamentMode)) {
@ -355,7 +357,7 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
}*/
}
else {
if (entity.mTeam == TEAM_ONE) {
/* if (entity.mTeam == TEAM_ONE) {
outR = 0.33;
outG = 0.95;
outB = 1.0;
@ -386,17 +388,51 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
outR = 0.0;
outG = 0.0;
outB = 0.0;
}
}*/
if (isStructure) {
cl_entity_s* theStructEntity = gEngfuncs.GetEntityByIndex(entity.mEntityNumber);
int health = theStructEntity->curstate.health;
int solid = theStructEntity->curstate.solid;
int f1 = theStructEntity->curstate.fuser1;
int f2 = theStructEntity->curstate.fuser2;
int f3 = theStructEntity->curstate.fuser3;
int f4 = theStructEntity->curstate.fuser4;
ConsolePrint("--------------------------------\n");
ConsolePrint(("ENTITY ID : " + to_string(entity.mEntityNumber)).c_str());
ConsolePrint("--------------------------------\n");
ConsolePrint(("health " +to_string(health)+"\n").c_str());
ConsolePrint(("solid " + to_string(solid) + "\n").c_str());
ConsolePrint(("f1 " + to_string(f1) + "\n").c_str());
ConsolePrint(("f2 " + to_string(f2) + "\n").c_str());
ConsolePrint(("f3 " + to_string(f4) + "\n").c_str());
ConsolePrint(("f4 " + to_string(f4) + "\n").c_str());
ConsolePrint("--------------------------------\n");
if (entity.mTeam == TEAM_ONE) {
outR = 0.43;
outG = 0.70;
outB = 1.0;
if (f1 == 1000) {
outR = 0.43; //110
outG = 0.70; //180
outB = 1.0; //255
}
else {
outR = 200.0/255.0; //110
outG = 200.0/255.0; //180
outB = 255; //255
}
}
else if (entity.mTeam == TEAM_TWO) {
outR = 0.88;
outG = 0.45;
outB = 0.00;
if (f1 == 1000) {
outR = 0.88;
outG = 0.45;
outB = 0.00;
}
else {
outR = 255.0 / 255.0; //110
outG = 200.0 / 255.0; //180
outB = 200.0; //255
}
}
}
}

View file

@ -269,7 +269,7 @@ extern int gNumFullPackCalls;
extern int gWeaponAnimationEventID;
extern int gMetabolizeSuccessEventID;
extern int gPhaseInEventID;
extern bool mIsReady; // for tournamentmode, if player is ready
// Yucky globals
extern AvHParticleTemplateListServer gParticleTemplateList;
extern AvHSoundListManager gSoundListManager;
@ -298,6 +298,14 @@ AvHPlayer::AvHPlayer()
this->InitBalanceVariables();
}
void AvHPlayer::setReady(bool ready) {
mIsReady = ready;
}
bool AvHPlayer::getReadyStatus() {
return mIsReady;
}
void AvHPlayer::AddDebugEnemyBlip(float inX, float inY, float inZ)
{
this->mEnemyBlips.AddBlip(inX, inY, inZ);

View file

@ -603,6 +603,9 @@ private:
void balanceValueRemoved(const string& name, const int old_value) const;
void balanceValueRemoved(const string& name, const string& old_value) const;
void setReady(bool ready);
bool getReadyStatus();
float mResources;
bool mFirstUpdate;

View file

@ -52,10 +52,12 @@ void NetworkMeterMessageBegin(int msg_dest, int msg_type, const float* pOrigin,
if(ns_cvar_float(&avh_networkdebug) > 0)
networkDebug=true;
#endif
networkDebug = true;
if(networkDebug)
{
char theDebugString[512];
sprintf(theDebugString, "MessageBegin(%d, %d...)\n", msg_dest, msg_type);
UTIL_LogPrintf(theDebugString, "MessageBegin(%d, %d...)\n", msg_dest, msg_type);
ALERT(at_logged, theDebugString);
}