diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp
index a4a6024..ae6f2e2 100644
--- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp
+++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp
@@ -801,7 +801,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
memset(info->data.players, 0, sizeof(info->data.players));
memset(info->data.szPlayers, 0, sizeof(info->data.szPlayers));
- for (int p = 0; p < MINECRAFT_NET_MAX_PLAYERS && p < lanSessions[i].playerCount; p++)
+ for (int p = 0; p < WIN64_LAN_BROADCAST_PLAYERS && p < lanSessions[i].playerCount; p++)
{
if (lanSessions[i].playerNames[p][0] != 0)
{
diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp
index 1978f2a..edc1515 100644
--- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp
+++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp
@@ -1542,7 +1542,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen)
bool isClientSide = false;
bool isPrivate = false;
// TODO int maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
- int maxPlayers = 8;
+ int maxPlayers = MINECRAFT_NET_MAX_PLAYERS;
if( app.GetTutorialMode() )
{
diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp
index 8b221be..2635ddf 100644
--- a/Minecraft.Client/Extrax64Stubs.cpp
+++ b/Minecraft.Client/Extrax64Stubs.cpp
@@ -355,7 +355,8 @@ IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex)
static bool Win64_IsActivePlayer(IQNetPlayer *p, DWORD index)
{
if (index == 0) return true;
- return (p->GetCustomDataValue() != 0);
+ if (p->GetCustomDataValue() != 0) return true;
+ return (p->m_isRemote && p->m_gamertag[0] != 0);
}
IQNetPlayer *IQNet::GetPlayerByIndex(DWORD dwPlayerIndex)
diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj
index 0c82b66..2addbbb 100644
--- a/Minecraft.Client/Minecraft.Client.vcxproj
+++ b/Minecraft.Client/Minecraft.Client.vcxproj
@@ -17084,7 +17084,6 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse
false
-
true
true
diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters
index 432ec62..feb60b7 100644
--- a/Minecraft.Client/Minecraft.Client.vcxproj.filters
+++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters
@@ -3631,9 +3631,6 @@
Orbis\Network
-
- Xbox\Source Files\Network
-
Common\Source Files\UI\Scenes
diff --git a/Minecraft.Client/MobRenderer.cpp b/Minecraft.Client/MobRenderer.cpp
index 8874ab9..f8a1599 100644
--- a/Minecraft.Client/MobRenderer.cpp
+++ b/Minecraft.Client/MobRenderer.cpp
@@ -400,7 +400,7 @@ void MobRenderer::renderNameTag(shared_ptr mob, const wstring& OriginalName
if (player != NULL && app.isXuidDeadmau5( player->getXuid() ) ) offs = -10;
wstring playerName;
- WCHAR wchName[2];
+ WCHAR wchName[8];
#if defined(__PS3__) || defined(__ORBIS__)
// Check we have all the font characters for this player name
@@ -414,8 +414,8 @@ void MobRenderer::renderNameTag(shared_ptr mob, const wstring& OriginalName
}
else
{
- memset(wchName,0,sizeof(WCHAR)*2);
- swprintf(wchName, 2, L"%d",player->getPlayerIndex()+1);
+ memset(wchName,0,sizeof(wchName));
+ swprintf(wchName, 8, L"%d",player->getPlayerIndex()+1);
playerName=wchName;
player->SetPlayerNameValidState(false);
}
@@ -424,8 +424,8 @@ void MobRenderer::renderNameTag(shared_ptr mob, const wstring& OriginalName
playerName=OriginalName;
break;
case Player::ePlayerNameValid_False:
- memset(wchName,0,sizeof(WCHAR)*2);
- swprintf(wchName, 2, L"%d",player->getPlayerIndex()+1);
+ memset(wchName,0,sizeof(wchName));
+ swprintf(wchName, 8, L"%d",player->getPlayerIndex()+1);
playerName=wchName;
break;
}
diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp
index c332b41..73b504f 100644
--- a/Minecraft.Client/PlayerRenderer.cpp
+++ b/Minecraft.Client/PlayerRenderer.cpp
@@ -13,19 +13,44 @@
#include "..\Minecraft.World\net.minecraft.h"
#include "..\Minecraft.World\StringHelpers.h"
-const unsigned int PlayerRenderer::s_nametagColors[MINECRAFT_NET_MAX_PLAYERS] =
+unsigned int PlayerRenderer::s_nametagColors[MINECRAFT_NET_MAX_PLAYERS];
+
+static unsigned int HsvToArgb(float h, float s, float v)
{
- 0xff000000, // WHITE (represents the "white" player, but using black as the colour)
- 0xff33cc33, // GREEN
- 0xffcc3333, // RED
- 0xff3333cc, // BLUE
-#ifndef __PSVITA__ // only 4 player on Vita
- 0xffcc33cc, // PINK
- 0xffcc6633, // ORANGE
- 0xffcccc33, // YELLOW
- 0xff33dccc, // TURQUOISE
-#endif
-};
+ float c = v * s;
+ float x = c * (1.0f - fabsf(fmodf(h / 60.0f, 2.0f) - 1.0f));
+ float m = v - c;
+ float r, g, b;
+ if (h < 60) { r = c; g = x; b = 0; }
+ else if (h < 120) { r = x; g = c; b = 0; }
+ else if (h < 180) { r = 0; g = c; b = x; }
+ else if (h < 240) { r = 0; g = x; b = c; }
+ else if (h < 300) { r = x; g = 0; b = c; }
+ else { r = c; g = 0; b = x; }
+ unsigned int ri = (unsigned int)((r + m) * 255.0f);
+ unsigned int gi = (unsigned int)((g + m) * 255.0f);
+ unsigned int bi = (unsigned int)((b + m) * 255.0f);
+ return 0xFF000000 | (ri << 16) | (gi << 8) | bi;
+}
+
+void PlayerRenderer::InitNametagColors()
+{
+ s_nametagColors[0] = 0xff000000;
+ s_nametagColors[1] = 0xff33cc33;
+ s_nametagColors[2] = 0xffcc3333;
+ s_nametagColors[3] = 0xff3333cc;
+ s_nametagColors[4] = 0xffcc33cc;
+ s_nametagColors[5] = 0xffcc6633;
+ s_nametagColors[6] = 0xffcccc33;
+ s_nametagColors[7] = 0xff33dccc;
+ for (int i = 8; i < MINECRAFT_NET_MAX_PLAYERS; i++)
+ {
+ float hue = fmodf(i * 137.508f, 360.0f);
+ float sat = 0.65f + (float)(i % 3) * 0.15f;
+ float val = 0.75f + (float)(i % 4) * 0.08f;
+ s_nametagColors[i] = HsvToArgb(hue, sat, val);
+ }
+}
const wstring PlayerRenderer::MATERIAL_NAMES[5] = { L"cloth", L"chain", L"iron", L"diamond", L"gold" };
@@ -304,11 +329,11 @@ void PlayerRenderer::renderName(shared_ptr _mob, double x, double y, double
{
if (mob->isSleeping())
{
- renderNameTag(mob, msg, x, y - 1.5f, z, 64, s_nametagColors[mob->getPlayerIndex()]);
+ renderNameTag(mob, msg, x, y - 1.5f, z, 64, getNametagColour(mob->getPlayerIndex()));
}
else
{
- renderNameTag(mob, msg, x, y, z, 64, s_nametagColors[mob->getPlayerIndex()]);
+ renderNameTag(mob, msg, x, y, z, 64, getNametagColour(mob->getPlayerIndex()));
}
}
}
diff --git a/Minecraft.Client/PlayerRenderer.h b/Minecraft.Client/PlayerRenderer.h
index 1056410..30de0a5 100644
--- a/Minecraft.Client/PlayerRenderer.h
+++ b/Minecraft.Client/PlayerRenderer.h
@@ -8,7 +8,7 @@ class PlayerRenderer : public MobRenderer
{
private:
// 4J Added
- static const unsigned int s_nametagColors[MINECRAFT_NET_MAX_PLAYERS];
+ static unsigned int s_nametagColors[MINECRAFT_NET_MAX_PLAYERS];
HumanoidModel *humanoidModel;
HumanoidModel *armorParts1;
@@ -18,6 +18,7 @@ public:
PlayerRenderer();
static unsigned int getNametagColour(int index);
+ static void InitNametagColors();
private:
static const wstring MATERIAL_NAMES[5];
diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp
index 9452f8f..ebadc73 100644
--- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp
+++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp
@@ -797,7 +797,7 @@ void WinsockNetLayer::UpdateAdvertisePlayerNames(BYTE count, const char playerNa
EnterCriticalSection(&s_advertiseLock);
memset(s_advertiseData.playerNames, 0, sizeof(s_advertiseData.playerNames));
s_advertiseData.playerCount = count;
- for (int i = 0; i < count && i < 8; i++)
+ for (int i = 0; i < count && i < WIN64_LAN_BROADCAST_PLAYERS; i++)
{
memcpy(s_advertiseData.playerNames[i], playerNames[i], XUSER_NAME_SIZE);
}
@@ -936,7 +936,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
broadcast->hostName[31] = L'\0';
- for (int pn = 0; pn < 8; pn++)
+ for (int pn = 0; pn < WIN64_LAN_BROADCAST_PLAYERS; pn++)
broadcast->playerNames[pn][XUSER_NAME_SIZE - 1] = '\0';
char senderIP[64];
diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h
index 4649ec4..afebabe 100644
--- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h
+++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h
@@ -15,6 +15,7 @@
#define WIN64_NET_MAX_PACKET_SIZE (3 * 1024 * 1024)
#define WIN64_LAN_DISCOVERY_PORT 25566
#define WIN64_LAN_BROADCAST_MAGIC 0x4D434C4E
+#define WIN64_LAN_BROADCAST_PLAYERS 8
class Socket;
@@ -31,7 +32,7 @@ struct Win64LANBroadcast
DWORD texturePackParentId;
BYTE subTexturePackId;
BYTE isJoinable;
- char playerNames[8][XUSER_NAME_SIZE];
+ char playerNames[WIN64_LAN_BROADCAST_PLAYERS][XUSER_NAME_SIZE];
};
#pragma pack(pop)
@@ -48,7 +49,7 @@ struct Win64LANSession
unsigned char subTexturePackId;
bool isJoinable;
DWORD lastSeenTick;
- char playerNames[8][XUSER_NAME_SIZE];
+ char playerNames[WIN64_LAN_BROADCAST_PLAYERS][XUSER_NAME_SIZE];
};
struct Win64RemoteConnection
diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
index 6a6bfea..ebbf9a4 100644
--- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
+++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp
@@ -41,6 +41,8 @@
#include "Network\WinsockNetLayer.h"
+#include "..\PlayerRenderer.h"
+
#include "Windows64_PostProcess.h"
#include "Xbox/resource.h"
@@ -832,6 +834,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
g_Win64MultiplayerPort = atoi(portBuf);
if (g_Win64MultiplayerPort <= 0) g_Win64MultiplayerPort = WIN64_NET_DEFAULT_PORT;
}
+
}
if (g_Win64Username[0] == 0)
@@ -1040,6 +1043,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
extern wchar_t g_Win64UsernameW[17];
wcscpy_s(IQNet::m_player[0].m_gamertag, 32, g_Win64UsernameW);
+ PlayerRenderer::InitNametagColors();
+
WinsockNetLayer::Initialize();
diff --git a/Minecraft.Client/Xbox/Network/extra.h b/Minecraft.Client/Xbox/Network/extra.h
deleted file mode 100644
index 10e8595..0000000
--- a/Minecraft.Client/Xbox/Network/extra.h
+++ /dev/null
@@ -1,4 +0,0 @@
-
-#pragma once
-
-const int MINECRAFT_NET_MAX_PLAYERS = 8;
\ No newline at end of file
diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h
index a7ba7b0..d718cdd 100644
--- a/Minecraft.Client/stdafx.h
+++ b/Minecraft.Client/stdafx.h
@@ -107,9 +107,12 @@ typedef XNKID SessionID;
typedef XUID GameSessionUID;
#define HRESULT_SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
-#include "..\Minecraft.Client\xbox\network\extra.h"
-#else
#include "extraX64.h"
+
+#else
+
+#include "extraX64.h"
+
#endif
#ifdef __PS3__