mirror of
https://github.com/LCEMP/LCEMP.git
synced 2026-05-09 07:07:30 +00:00
fix: support more max players
This commit is contained in:
parent
d017bfc30a
commit
771a632f05
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -17084,7 +17084,6 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|Xbox 360'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseForArt|Xbox 360'">false</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Xbox\Network\extra.h" />
|
||||
<ClInclude Include="Xbox\Network\NetworkPlayerXbox.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Durango'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Durango'">true</ExcludedFromBuild>
|
||||
|
|
|
|||
|
|
@ -3631,9 +3631,6 @@
|
|||
<ClInclude Include="Orbis\Network\PsPlusUpsellWrapper_Orbis.h">
|
||||
<Filter>Orbis\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Xbox\Network\extra.h">
|
||||
<Filter>Xbox\Source Files\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\UI\UIScene_Keyboard.h">
|
||||
<Filter>Common\Source Files\UI\Scenes</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ void MobRenderer::renderNameTag(shared_ptr<Mob> 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> 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> 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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> _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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
const int MINECRAFT_NET_MAX_PLAYERS = 8;
|
||||
|
|
@ -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__
|
||||
|
|
|
|||
Loading…
Reference in a new issue