diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 7b2e67e77f..ec81bfcbb1 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -2312,6 +2312,11 @@ void CClientGame::SetAllDimensions(unsigned short usDimension) m_pCamera->SetDimension(usDimension); } +void CClientGame::SetAllInteriors(unsigned char ucInterior) +{ + m_pNametags->m_ucInterior = ucInterior; +} + bool CClientGame::StaticKeyStrokeHandler(const SString& strKey, bool bState, bool bIsConsoleInputKey) { return g_pClientGame->KeyStrokeHandler(strKey, bState, bIsConsoleInputKey); @@ -5683,8 +5688,9 @@ void CClientGame::ResetMapInfo() m_pCamera->SetFocusToLocalPlayer(); g_pGame->GetSettings()->ResetFieldOfViewFromScript(); - // Dimension + // Dimension and interiors SetAllDimensions(0); + SetAllInteriors(0); // Hud g_pGame->GetHud()->SetComponentVisible(HUD_ALL, true); diff --git a/Client/mods/deathmatch/logic/CClientGame.h b/Client/mods/deathmatch/logic/CClientGame.h index cfd1385db7..94740a1a03 100644 --- a/Client/mods/deathmatch/logic/CClientGame.h +++ b/Client/mods/deathmatch/logic/CClientGame.h @@ -349,6 +349,7 @@ class CClientGame void ResetVehicleInOut(); void SetAllDimensions(unsigned short usDimension); + void SetAllInteriors(unsigned char ucInterior); static bool StaticKeyStrokeHandler(const SString& strKey, bool bState, bool bIsConsoleInputKey); bool KeyStrokeHandler(const SString& strKey, bool bState, bool bIsConsoleInputKey); diff --git a/Client/mods/deathmatch/logic/CNametags.cpp b/Client/mods/deathmatch/logic/CNametags.cpp index d38744307e..83a25edccd 100644 --- a/Client/mods/deathmatch/logic/CNametags.cpp +++ b/Client/mods/deathmatch/logic/CNametags.cpp @@ -25,6 +25,8 @@ using std::list; #define DEFAULT_VIEW_RANGE 45.0f #define DEFAULT_VIEW_RANGE_EXP ((DEFAULT_VIEW_RANGE)*(DEFAULT_VIEW_RANGE)) +const bool bRenderOwn = false; + CNametags::CNametags(CClientManager* pManager) { m_pPlayerStreamer = pManager->GetPlayerStreamer(); @@ -261,7 +263,7 @@ void CNametags::DrawDefault() static float fResHeight = static_cast(g_pCore->GetGraphics()->GetViewportHeight()); // Got any players that are not local? - if (m_pPlayerManager->Count() <= 1) + if (m_pPlayerManager->Count() <= 1 && !bRenderOwn) return; list playerTags; @@ -363,7 +365,7 @@ void CNametags::DrawDefault() if (pElement->GetType() != CCLIENTPLAYER) continue; pPlayer = static_cast(pElement); - if (pPlayer->IsLocalPlayer()) + if (pPlayer->IsLocalPlayer() && !bRenderOwn) continue; // Get the distance from the camera @@ -428,8 +430,16 @@ void CNametags::DrawDefault() void CNametags::DrawTagForPlayer(CClientPlayer* pPlayer, unsigned char ucAlpha) { - // If they aren't in the same dimension, dont draw - if (pPlayer->GetDimension() != m_usDimension || !pPlayer->IsNametagShowing()) + // If nametag is hidden, don't draw + if (!pPlayer->IsNametagShowing()) + return; + + // If they aren't in the same dimension, don't draw + if (pPlayer->GetDimension() != m_usDimension) + return; + + // If they aren't in the same interior, don't draw + if (pPlayer->GetInterior() != m_ucInterior) return; // Grab the resolution width and height diff --git a/Client/mods/deathmatch/logic/CNametags.h b/Client/mods/deathmatch/logic/CNametags.h index a5d8cc086b..61c51fd92b 100644 --- a/Client/mods/deathmatch/logic/CNametags.h +++ b/Client/mods/deathmatch/logic/CNametags.h @@ -40,6 +40,8 @@ class CNametags bool IsVisible() { return m_bVisible; } void SetVisible(bool bVisible) { m_bVisible = bVisible; } + unsigned char m_ucInterior = 0; + private: static bool CompareNametagDistance(CClientPlayer* p1, CClientPlayer* p2); diff --git a/Client/mods/deathmatch/logic/CPacketHandler.cpp b/Client/mods/deathmatch/logic/CPacketHandler.cpp index 33bd3cbd9d..979c971e9b 100644 --- a/Client/mods/deathmatch/logic/CPacketHandler.cpp +++ b/Client/mods/deathmatch/logic/CPacketHandler.cpp @@ -1109,9 +1109,9 @@ void CPacketHandler::Packet_PlayerSpawn(NetBitStreamInterface& bitStream) // Reset vehicle in/out stuff g_pClientGame->ResetVehicleInOut(); - // Make sure all other elements are aware of what dimension we are in now. - // So elements can be removed properly. + // Announce our dimension/interior to all elements, so that elements are removed properly g_pClientGame->SetAllDimensions(usDimension); + g_pClientGame->SetAllInteriors(ucInterior); // Reset return position so we can't warp back to where we were if local player g_pClientGame->m_pNetAPI->ResetReturnPosition(); diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 3fe9113e34..b6b1fa1b6c 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -1237,6 +1237,16 @@ bool CStaticFunctionDefinitions::SetElementInterior(CClientEntity& Entity, unsig if (bSetPosition) Entity.SetPosition(vecPosition); + if (Entity.GetType() == CCLIENTPLAYER) + { + CClientPed& Ped = static_cast(Entity); + if (Ped.IsLocalPlayer()) + { + // Update all of our streamers/managers to the local player's interior + m_pClientGame->SetAllInteriors(ucInterior); + } + } + return true; } diff --git a/Client/mods/deathmatch/logic/rpc/CElementRPCs.cpp b/Client/mods/deathmatch/logic/rpc/CElementRPCs.cpp index ba4204d366..2e0d6e2294 100644 --- a/Client/mods/deathmatch/logic/rpc/CElementRPCs.cpp +++ b/Client/mods/deathmatch/logic/rpc/CElementRPCs.cpp @@ -253,6 +253,15 @@ void CElementRPCs::SetElementInterior(CClientEntity* pSource, NetBitStreamInterf if (bitStream.Read(ucInterior) && bitStream.Read(ucSetPosition)) { pSource->SetInterior(ucInterior); + if (pSource->GetType() == CCLIENTPLAYER) + { + CClientPlayer* pPlayer = static_cast(pSource); + if (pPlayer->IsLocalPlayer()) + { + // Update all of our streamers/managers to the local player's interior + m_pClientGame->SetAllInteriors(ucInterior); + } + } if (ucSetPosition == 1) {