diff --git a/Client/game_sa/C3DMarkersSA.cpp b/Client/game_sa/C3DMarkersSA.cpp index 86f1f8d4ef8..8265cfe01d1 100644 --- a/Client/game_sa/C3DMarkersSA.cpp +++ b/Client/game_sa/C3DMarkersSA.cpp @@ -99,3 +99,15 @@ C3DMarker* C3DMarkersSA::FindMarker(DWORD Identifier) } return NULL; } + +void C3DMarkersSA::ReinitMarkers() +{ + using Function_ShutdownMarkers = void(__cdecl *)(); + auto shutdownMarkers = reinterpret_cast(0x722710); + + using Function_InitMarkers = void(__cdecl*)(); + auto initMarkers = reinterpret_cast(0x724E40); + + shutdownMarkers(); + initMarkers(); +} diff --git a/Client/game_sa/C3DMarkersSA.h b/Client/game_sa/C3DMarkersSA.h index 9a0ead2f329..8f2cff3093b 100644 --- a/Client/game_sa/C3DMarkersSA.h +++ b/Client/game_sa/C3DMarkersSA.h @@ -31,4 +31,5 @@ class C3DMarkersSA : public C3DMarkers C3DMarker* CreateMarker(DWORD Identifier, e3DMarkerType dwType, CVector* vecPosition, float fSize, float fPulseFraction, BYTE r, BYTE g, BYTE b, BYTE a); C3DMarker* FindFreeMarker(); C3DMarker* FindMarker(DWORD Identifier); + void ReinitMarkers(); }; diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index cee25e7987a..d2756247593 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -5425,6 +5425,8 @@ void CClientGame::ResetMapInfo() pPlayerInfo->SetCamDrunkLevel(static_cast(0)); RestreamWorld(true); + + ReinitMarkers(); } void CClientGame::SendPedWastedPacket(CClientPed* Ped, ElementID damagerID, unsigned char ucWeapon, unsigned char ucBodyPiece, AssocGroupId animGroup, @@ -6565,6 +6567,11 @@ void CClientGame::RestreamWorld(bool removeBigBuildings) g_pGame->GetStreaming()->ReinitStreaming(); } +void CClientGame::ReinitMarkers() +{ + g_pGame->Get3DMarkers()->ReinitMarkers(); +} + void CClientGame::OnWindowFocusChange(bool state) { if (state == m_bFocused) diff --git a/Client/mods/deathmatch/logic/CClientGame.h b/Client/mods/deathmatch/logic/CClientGame.h index d1e15339aea..50181c28d67 100644 --- a/Client/mods/deathmatch/logic/CClientGame.h +++ b/Client/mods/deathmatch/logic/CClientGame.h @@ -440,6 +440,7 @@ class CClientGame bool TriggerBrowserRequestResultEvent(const std::unordered_set& newPages); void RestreamModel(unsigned short usModel); void RestreamWorld(bool removeBigBuildings); + void ReinitMarkers(); void OnWindowFocusChange(bool state); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp index bb4335176ff..3479cb1a451 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp @@ -82,6 +82,7 @@ void CLuaEngineDefs::LoadFunctions() {"engineGetModelTXDID", ArgumentParser}, {"engineStreamingFreeUpMemory", ArgumentParser}, {"engineStreamingGetUsedMemory", ArgumentParser}, + {"engineReinitMarkers", ArgumentParser}, // CLuaCFunctions::AddFunction ( "engineReplaceMatchingAtomics", EngineReplaceMatchingAtomics ); // CLuaCFunctions::AddFunction ( "engineReplaceWheelAtomics", EngineReplaceWheelAtomics ); @@ -2321,3 +2322,8 @@ bool CLuaEngineDefs::EngineRestreamWorld(lua_State* const luaVM) g_pClientGame->RestreamWorld(restreamLODs); return true; } + +void CLuaEngineDefs::EngineReinitMarkers() +{ + g_pClientGame->ReinitMarkers(); +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.h index 07af6a93e3f..2695e93fb10 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.h @@ -77,6 +77,7 @@ class CLuaEngineDefs : public CLuaDefs static bool EngineRestreamWorld(lua_State* const luaVM); static bool EngineSetModelVisibleTime(std::string strModelId, char cHourOn, char cHourOff); static std::variant> EngineGetModelVisibleTime(std::string strModelId); + static void EngineReinitMarkers(); private: static void AddEngineColClass(lua_State* luaVM); diff --git a/Client/sdk/game/C3DMarkers.h b/Client/sdk/game/C3DMarkers.h index 98eb61503a2..47c643ff6f6 100644 --- a/Client/sdk/game/C3DMarkers.h +++ b/Client/sdk/game/C3DMarkers.h @@ -22,4 +22,5 @@ class C3DMarkers virtual C3DMarker* CreateMarker(DWORD Identifier, e3DMarkerType dwType, CVector* vecPosition, float fSize, float fPulseFraction, BYTE r, BYTE g, BYTE b, BYTE a) = 0; virtual C3DMarker* FindFreeMarker() = 0; + virtual void ReinitMarkers() = 0; };