diff --git a/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp b/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp index 2c5acccf..fba5a944 100644 --- a/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp +++ b/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp @@ -1309,7 +1309,7 @@ void NetworkSocketLayer::UpdateAdvertisePlayerNames(BYTE count, const char playe 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 < NETWORK_LAN_BROADCAST_PLAYERS; i++) { memcpy(s_advertiseData.playerNames[i], playerNames[i], NETWORK_LAN_PLAYER_NAME_SIZE < (int)XUSER_NAME_SIZE ? NETWORK_LAN_PLAYER_NAME_SIZE : (int)XUSER_NAME_SIZE); @@ -1587,7 +1587,7 @@ int NetworkSocketLayer::DiscoveryThreadProc(LPVOID param) broadcast->hostName[31] = L'\0'; - for (int pn = 0; pn < 8; pn++) + for (int pn = 0; pn < NETWORK_LAN_BROADCAST_PLAYERS; pn++) broadcast->playerNames[pn][XUSER_NAME_SIZE - 1] = '\0'; char senderIP[64]; diff --git a/Minecraft.Client/Common/Network/NetworkSocketLayer.h b/Minecraft.Client/Common/Network/NetworkSocketLayer.h index ee56e7c7..908a4b61 100644 --- a/Minecraft.Client/Common/Network/NetworkSocketLayer.h +++ b/Minecraft.Client/Common/Network/NetworkSocketLayer.h @@ -38,6 +38,7 @@ #define NETWORK_LAN_MAX_PACKET_SIZE (3 * 1024 * 1024) #define NETWORK_LAN_DISCOVERY_PORT 25566 #define NETWORK_LAN_BROADCAST_MAGIC 0x4D434C4E +#define NETWORK_LAN_BROADCAST_PLAYERS 8 #ifdef __PS3__ typedef int SOCKET; @@ -115,7 +116,7 @@ struct LANBroadcast DWORD texturePackParentId; BYTE subTexturePackId; BYTE isJoinable; - char playerNames[8][NETWORK_LAN_PLAYER_NAME_SIZE]; + char playerNames[NETWORK_LAN_BROADCAST_PLAYERS][NETWORK_LAN_PLAYER_NAME_SIZE]; }; #pragma pack(pop) @@ -132,7 +133,7 @@ struct LANSession unsigned char subTexturePackId; bool isJoinable; DWORD lastSeenTick; - char playerNames[8][NETWORK_LAN_PLAYER_NAME_SIZE]; + char playerNames[NETWORK_LAN_BROADCAST_PLAYERS][NETWORK_LAN_PLAYER_NAME_SIZE]; }; struct RemoteConnection diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp index af454b31..968ff578 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManager.cpp @@ -811,7 +811,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 < NETWORK_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 aeeb871f..98ebbd23 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1597,7 +1597,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 4c605e7f..2d50b945 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -598,7 +598,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/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index 7f4a3258..a4d0ecb1 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -531,7 +531,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst int offs = 0; wstring playerName; - WCHAR wchName[2]; + WCHAR wchName[8]; if(mob->instanceof(eTYPE_PLAYER)) { @@ -551,7 +551,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst } else { - memset(wchName,0,sizeof(WCHAR)*2); + memset(wchName,0,sizeof(wchName)); swprintf(wchName, 2, L"%d",player->getPlayerIndex()+1); playerName=wchName; player->SetPlayerNameValidState(false); @@ -561,7 +561,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst playerName=name; break; case Player::ePlayerNameValid_False: - memset(wchName,0,sizeof(WCHAR)*2); + memset(wchName,0,sizeof(wchName)d); swprintf(wchName, 2, L"%d",player->getPlayerIndex()+1); playerName=wchName; break; diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index d1674507..df0dcdbb 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -16586,7 +16586,6 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse false - true true @@ -36696,4 +36695,4 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU - + \ No newline at end of file diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters index f92e8d8d..4b4cb47b 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj.filters +++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters @@ -3611,9 +3611,6 @@ Orbis\Network - - Xbox\Source Files\Network - Common\Source Files\UI\Scenes diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index 6e6b6626..77ec0fdd 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -38,13 +38,35 @@ PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0 armorParts2 = new HumanoidModel(0.5f); } +static unsigned int HsvToArgb(float h, float s, float v) +{ + 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; +} + unsigned int PlayerRenderer::getNametagColour(int index) { if( index >= 0 && index < MINECRAFT_NET_MAX_PLAYERS) { return s_nametagColors[index]; } - return 0xFF000000; + + float hue = fmodf(index * 137.508f, 360.0f); + float sat = 0.65f + (float)(index % 3) * 0.15f; + float val = 0.75f + (float)(index % 4) * 0.08f; + return HsvToArgb(hue, sat, val); } int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, float a) diff --git a/Minecraft.Client/Xbox/Network/extra.h b/Minecraft.Client/Xbox/Network/extra.h deleted file mode 100644 index 70085d5b..00000000 --- a/Minecraft.Client/Xbox/Network/extra.h +++ /dev/null @@ -1,4 +0,0 @@ - -#pragma once - -const int MINECRAFT_NET_MAX_PLAYERS = 8; diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 864648d9..b0abc003 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -131,8 +131,6 @@ typedef XUID GameSessionUID; #ifndef _XBOX #include "extraX64.h" -#else -#include "..\Minecraft.Client\xbox\network\extra.h" #endif #include "Definitions.h"