Skip to content

Streaming fix #4201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Client/mods/deathmatch/logic/CClientObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ void CClientObject::SetOrientation(const CVector& vecPosition, const CVector& ve

void CClientObject::ModelRequestCallback(CModelInfo* pModelInfo)
{
// The model loading may take a while and there's a chance of object being moved to other dimension.
if (!IsVisibleInAllDimensions() && GetDimension() != m_pStreamer->GetDimension())
{
NotifyUnableToCreate();
return;
}

// Create our object
Create();
}
Expand Down
7 changes: 7 additions & 0 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4041,6 +4041,13 @@ void CClientPed::ReCreateGameEntity()

void CClientPed::ModelRequestCallback(CModelInfo* pModelInfo)
{
// The model loading may take a while and there's a chance of ped being moved to other dimension.
if (!IsVisibleInAllDimensions() && GetDimension() != m_pStreamer->GetDimension())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!ShouldBeVisibleInCurrentDimension())

And you can keep m_pStreamer private

{
NotifyUnableToCreate();
return;
}

// If we have a player loaded
if (m_pPlayerPed)
{
Expand Down
8 changes: 4 additions & 4 deletions Client/mods/deathmatch/logic/CClientStreamElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ class CClientStreamElement : public CClientEntity
void SetStreamRow(CClientStreamSectorRow* pRow) { m_pStreamRow = pRow; }
void SetStreamSector(CClientStreamSector* pSector) { m_pStreamSector = pSector; }
void SetExpDistance(float fDistance) { m_fExpDistance = fDistance; }

CClientStreamer* m_pStreamer;

CClientStreamSectorRow* m_pStreamRow;
CClientStreamSector* m_pStreamSector;
CVector m_vecStreamPosition;
float m_fExpDistance;
unsigned short m_usStreamReferences, m_usStreamReferencesScript;

protected:
bool m_bStreamedIn;
bool m_bAttemptingToStreamIn;
CClientStreamer* m_pStreamer;
bool m_bStreamedIn;
bool m_bAttemptingToStreamIn;

public:
float m_fCachedRadius;
Expand Down
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/CClientStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class CClientStreamer
std::list<CClientStreamElement*>::iterator ActiveElementsBegin() { return m_ActiveElements.begin(); }
std::list<CClientStreamElement*>::iterator ActiveElementsEnd() { return m_ActiveElements.end(); }

std::uint16_t GetDimension() const noexcept { return m_usDimension; }

private:
void CreateSectors(std::list<CClientStreamSectorRow*>* pList, CVector2D& vecSize, CVector2D& vecBottomLeft, CVector2D& vecTopRight);
void ConnectSector(CClientStreamSector* pSector);
Expand Down
7 changes: 7 additions & 0 deletions Client/mods/deathmatch/logic/CClientVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3084,6 +3084,13 @@ void CClientVehicle::ReCreate()

void CClientVehicle::ModelRequestCallback(CModelInfo* pModelInfo)
{
// The model loading may take a while and there's a chance of vehicle being moved to other dimension.
if (!IsVisibleInAllDimensions() && GetDimension() != m_pStreamer->GetDimension())
{
NotifyUnableToCreate();
return;
}

// Create the vehicle. The model is now loaded.
Create();
}
Expand Down
Loading