fixed Windows build for networking branch + player list + leaderboard + horse rendering #2

Merged
qloak merged 6 commits from lcemp-networking into lcemp-networking 2026-07-14 21:16:00 +00:00
21 changed files with 88 additions and 36 deletions
@@ -9,7 +9,9 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] =
L"Friends", L"MyScore", L"TopRank"
};
#if !defined(_WINDOWS64) && !defined(_DURANGO) && !defined(__ORBIS__) && !defined(__PS3__) && !defined(__PSVITA__) && !defined(_XBOX)
LeaderboardManager *LeaderboardManager::m_instance = NULL;
#endif
void LeaderboardManager::DeleteInstance()
{
@@ -165,6 +165,6 @@ private:
void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer );
#ifndef _XBOX
void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); }
void FakeLocalPlayerJoined() { AddLocalPlayerByUserIndex(0); }
#endif
};
@@ -93,7 +93,9 @@ void UIScene_InGameInfoMenu::updateTooltips()
if(CGameNetworkManager::usingAdhocMode()) keyX = -1;
#endif
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId);
INetworkPlayer *selectedPlayer = NULL;
if(m_playerList.getCurrentSelection() < m_players.size())
selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId);
int keyA = -1;
Minecraft *pMinecraft = Minecraft::GetInstance();
@@ -335,7 +337,9 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId)
break;
case eControl_GamePlayers:
int currentSelection = (int)childId;
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[currentSelection]->m_smallId);
INetworkPlayer *selectedPlayer = NULL;
if(currentSelection < m_players.size())
selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[currentSelection]->m_smallId);
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
@@ -387,6 +391,8 @@ void UIScene_InGameInfoMenu::handleFocusChange(F64 controlId, F64 childId)
void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
{
if(pPlayer == NULL) return;
app.DebugPrintf("<UIScene_InGameInfoMenu::OnPlayerChanged> Player \"%ls\" %s (smallId: %d)\n", pPlayer->GetOnlineName(), leaving ? "leaving" : "joining", pPlayer->GetSmallId());
UIScene_InGameInfoMenu *scene = (UIScene_InGameInfoMenu *)callbackParam;
+1 -1
View File
@@ -6,7 +6,7 @@
// 4J - added
void CreeperModel::_init(float g)
{
int yo = 4;
int yo = 6;
head = new ModelPart(this, 0, 0);
head->addBox(-4, - 8, -4, 8, 8, 8, g); // Head
+12 -5
View File
@@ -211,22 +211,29 @@ ULONG_PTR IQNetPlayer::GetCustomDataValue() {
return m_customData;
}
IQNetPlayer IQNet::m_player[4];
static IQNetPlayer s_playerArray[4];
IQNetPlayer *IQNet::m_player = s_playerArray;
DWORD IQNet::s_playerCapacity = 4;
DWORD IQNet::s_playerCount = 0;
bool IQNet::s_isHosting = false;
bool _bQNetStubGameRunning = false;
HRESULT IQNet::AddLocalPlayerByUserIndex(DWORD dwUserIndex){ return S_OK; }
void IQNet::SetPlayerCapacity(DWORD capacity) { s_playerCapacity = capacity; }
DWORD IQNet::GetPlayerCapacity() { return s_playerCapacity; }
IQNetPlayer *IQNet::GetHostPlayer() { return &m_player[0]; }
IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) { return &m_player[dwUserIndex]; }
IQNetPlayer *IQNet::GetPlayerByIndex(DWORD dwPlayerIndex) { return &m_player[0]; }
IQNetPlayer *IQNet::GetPlayerBySmallId(BYTE SmallId){ return &m_player[0]; }
IQNetPlayer *IQNet::GetPlayerByXuid(PlayerUID xuid){ return &m_player[0]; }
DWORD IQNet::GetPlayerCount() { return 1; }
DWORD IQNet::GetPlayerCount() { return s_playerCount; }
QNET_STATE IQNet::GetState() { return _bQNetStubGameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE; }
bool IQNet::IsHost() { return true; }
bool IQNet::IsHost() { return s_isHosting; }
HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo) { return S_OK; }
void IQNet::HostGame() { _bQNetStubGameRunning = true; }
void IQNet::EndGame() { _bQNetStubGameRunning = false; }
void IQNet::HostGame() { _bQNetStubGameRunning = true; s_isHosting = true; if(s_playerCount == 0) s_playerCount = 1; }
void IQNet::ClientJoinGame() { _bQNetStubGameRunning = true; s_isHosting = false; if(s_playerCount == 0) s_playerCount = 1; }
void IQNet::EndGame() { _bQNetStubGameRunning = false; s_isHosting = false; }
DWORD MinecraftDynamicConfigurations::GetTrialTime() { return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; }
+29 -3
View File
@@ -46,9 +46,35 @@ void HorseRenderer::renderModel(shared_ptr<LivingEntity> mob, float wp, float ws
}
else
{
EntityRenderer::bindTexture(mob);
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
// Ensure that any extra layers of texturing are disabled after rendering this horse
shared_ptr<EntityHorse> horse = dynamic_pointer_cast<EntityHorse>(mob);
ResourceLocation *location = getTextureLocation(mob);
// Pass 1: Bind only the coat texture (first valid layer) and render opaque
int coatTex = location->getTexture(0);
if( coatTex != -1 )
{
RenderManager.TextureBind(entityRenderDispatcher->textures->loadTexture(coatTex));
}
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
// Pass 2: If horse has armor, find the armor texture in the layers and render with blending
int armorType = horse->getArmorType();
if( armorType > 0 )
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for( int i = 1; i < location->getTextureCount(); i++ )
{
int texId = location->getTexture(i);
if( texId != -1 )
{
RenderManager.TextureBind(entityRenderDispatcher->textures->loadTexture(texId));
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
}
}
glDisable(GL_BLEND);
}
RenderManager.TextureBind(-1);
}
}
+1 -1
View File
@@ -491,7 +491,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr<LivingEntity> mob, const wst
float s = 1 / 60.0f * size;
glPushMatrix();
glTranslatef((float) x, (float) y + 2.3f, (float) z);
glTranslatef((float) x, (float) y + mob->bbHeight + 0.5f, (float) z);
glNormal3f(0, 1, 0);
glRotatef(-this->entityRenderDispatcher->playerRotY, 0, 1, 0);
+1 -1
View File
@@ -34044,7 +34044,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseForArt|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|Win32'">false</ExcludedFromBuild>
+1 -1
View File
@@ -1858,7 +1858,7 @@ void Minecraft::run_middle()
achievementPopup->render();
PIXBeginNamedEvent(0,"Sleeping");
Sleep(0); // 4J - was Thread.yield()
//Sleep(0); // 4J - was Thread.yield()
PIXEndNamedEvent();
// if (Keyboard::isKeyDown(Keyboard::KEY_F7)) Display.update(); // 4J - removed condition
+1 -1
View File
@@ -116,7 +116,7 @@ void Options::init()
bobView = true;
anaglyph3d = false;
advancedOpengl = false;
framerateLimit = 2;
framerateLimit = 0;
fancyGraphics = true;
ambientOcclusion = true;
renderClouds = true;
+5 -1
View File
@@ -434,7 +434,11 @@ void Textures::bindTextureLayers(ResourceLocation *resource)
for( int i = 0; i < layers; i++ )
{
RenderManager.TextureBind(loadTexture(resource->getTexture(i)));
int texId = resource->getTexture(i);
if( texId != -1 )
{
RenderManager.TextureBind(loadTexture(texId));
}
}
}
@@ -17,13 +17,23 @@ public:
virtual void DeleteSession() {}
//Write the given stats
//This is called synchronously and will not free any memory allocated for views when it is done
virtual bool WriteStats(unsigned int viewCount, ViewIn views) { return true; }
virtual bool WriteStats(unsigned int viewCount, ViewIn views) { return false; }
virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID) { return false; }
virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount) { return false; }
virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount) { return false; }
virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount) {
ReadView view = { 0, NULL };
callback->OnStatsReadComplete(eStatsReturn_Success, 0, view);
return true;
}
virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount) {
ReadView view = { 0, NULL };
callback->OnStatsReadComplete(eStatsReturn_Success, 0, view);
return true;
}
virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount) {
ReadView view = { 0, NULL };
callback->OnStatsReadComplete(eStatsReturn_Success, 0, view);
return true;
}
//Perform a flush of the stats
virtual void FlushStats() {}
@@ -498,7 +498,7 @@ app.DebugPrintf("width: %d, height: %d\n", width, height);
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory( &sd, sizeof( sd ) );
sd.BufferCount = 1;
sd.BufferCount = 2;
sd.BufferDesc.Width = width;
sd.BufferDesc.Height = height;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+2 -2
View File
@@ -552,13 +552,13 @@ bool AbstractContainerMenu::isPauseScreen()
void AbstractContainerMenu::setItem(unsigned int slot, shared_ptr<ItemInstance> item)
{
if (slot >= slots->size()) return;
if (slot >= slots.size()) return;
getSlot(slot)->set(item);
}
void AbstractContainerMenu::setAll(ItemInstanceArray *items)
{
for (unsigned int i = 0; i < items->length && i < slots->size(); i++)
for (unsigned int i = 0; i < items->length && i < slots.size(); i++)
{
getSlot(i)->set( (*items)[i] );
}
+1 -1
View File
@@ -10,7 +10,7 @@ double AttackDamageMobEffect::getAttributeModifierValue(int amplifier, Attribute
{
if (id == MobEffect::weakness->id)
{
return -0.5f * (amplifier + 1);
return -4.0f * (amplifier + 1);
}
else
{
+1 -1
View File
@@ -18,7 +18,7 @@ public:
dos->write(data);
}
void load(DataInput *dis)
void load(DataInput *dis, int tagDepth)
{
int length = dis->readInt();
if (length < 0 || length > 2 * 1024 * 1024) length = 0;
+1 -1
View File
@@ -1124,7 +1124,7 @@
<ExceptionHandling>Sync</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CallAttributedProfiling>Disabled</CallAttributedProfiling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
+1 -1
View File
@@ -490,7 +490,7 @@ LevelChunk *OldChunkStorage::load(Level *level, DataInputStream *dis)
{
CompoundTag *teTag = tileTicks->get(i);
level->forceAddTileTick(teTag->getInt(L"x"), teTag->getInt(L"y"), teTag->getInt(L"z"), teTag->getInt(L"i"), teTag->getInt(L"t"));
level->forceAddTileTick(teTag->getInt(L"x"), teTag->getInt(L"y"), teTag->getInt(L"z"), teTag->getInt(L"i"), teTag->getInt(L"t"), teTag->getInt(L"p"));
}
}
}
+1 -4
View File
@@ -126,7 +126,4 @@ DataOutputStream *RegionFileCache::_getChunkDataOutputStream(ConsoleSaveFile *sa
}
RegionFileCache::~RegionFileCache()
{
_clear();
}
+1 -1
View File
@@ -17,7 +17,7 @@ private:
public:
// Made public and non-static so we can have a cache for input and output files
RegionFileCache() { InitializeCriticalSectionAndSpinCount(&m_cs, 4000); }
~RegionFileCache() { DeleteCriticalSection(&m_cs); }
~RegionFileCache() { _clear(); DeleteCriticalSection(&m_cs); }
RegionFile *_getRegionFile(ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ); // 4J - TODO was synchronized
void _clear(); // 4J - TODO was synchronized
+1 -1
View File
@@ -115,7 +115,7 @@ Tag *Tag::readNamedTag(DataInput *dis)
Tag *tag = newTag(type, name);
if (tag == NULL) { depth--; return new EndTag(); }
tag->load(dis);
tag->load(dis, depth + 1);
depth--;
return tag;
}